libosmocore
1.4.0.171-b3b83
Osmocom core library
|
This module implements periodic reporting of statistics / counters. More...
Files | |
file | stats.c |
file | stats_statsd.c |
Data Structures | |
struct | osmo_stats_reporter |
One statistics reporter instance. More... | |
struct | osmo_stats_config |
Macros | |
#define | STATS_DEFAULT_INTERVAL 5 /* secs */ |
#define | STATS_DEFAULT_BUFLEN 256 |
Enumerations | |
enum | osmo_stats_class { OSMO_STATS_CLASS_UNKNOWN, OSMO_STATS_CLASS_GLOBAL, OSMO_STATS_CLASS_PEER, OSMO_STATS_CLASS_SUBSCRIBER } |
enum | osmo_stats_reporter_type { OSMO_STATS_REPORTER_LOG, OSMO_STATS_REPORTER_STATSD } |
enum | osmo_stats_class { OSMO_STATS_CLASS_UNKNOWN, OSMO_STATS_CLASS_GLOBAL, OSMO_STATS_CLASS_PEER, OSMO_STATS_CLASS_SUBSCRIBER } |
Statistics Class definitions. More... | |
enum | osmo_stats_reporter_type { OSMO_STATS_REPORTER_LOG, OSMO_STATS_REPORTER_STATSD } |
Statistics Reporter Type. More... | |
Functions | |
void | osmo_stats_init (void *ctx) |
Initilize the stats reporting module; call this once in your program. More... | |
int | osmo_stats_report () |
int | osmo_stats_set_interval (int interval) |
Set the reporting interval (common for all reporters) More... | |
struct osmo_stats_reporter * | osmo_stats_reporter_alloc (enum osmo_stats_reporter_type type, const char *name) |
void | osmo_stats_reporter_free (struct osmo_stats_reporter *srep) |
Destroy a given stats_reporter. More... | |
struct osmo_stats_reporter * | osmo_stats_reporter_find (enum osmo_stats_reporter_type type, const char *name) |
Find a stats_reporter of given type and name. More... | |
int | osmo_stats_reporter_set_remote_addr (struct osmo_stats_reporter *srep, const char *addr) |
int | osmo_stats_reporter_set_remote_port (struct osmo_stats_reporter *srep, int port) |
int | osmo_stats_reporter_set_local_addr (struct osmo_stats_reporter *srep, const char *addr) |
int | osmo_stats_reporter_set_mtu (struct osmo_stats_reporter *srep, int mtu) |
int | osmo_stats_reporter_set_max_class (struct osmo_stats_reporter *srep, enum osmo_stats_class class_id) |
int | osmo_stats_reporter_set_name_prefix (struct osmo_stats_reporter *srep, const char *prefix) |
Set the name prefix of a given stats_reporter. More... | |
int | osmo_stats_reporter_enable (struct osmo_stats_reporter *srep) |
Enable the given stats_reporter. More... | |
int | osmo_stats_reporter_disable (struct osmo_stats_reporter *srep) |
Disable the given stats_reporter. More... | |
int | osmo_stats_reporter_set_flush_period (struct osmo_stats_reporter *srep, unsigned int period) |
Set the regular flush period for a given stats_reporter. More... | |
struct osmo_stats_reporter * | osmo_stats_reporter_create_log (const char *name) |
Create a stats_reporter that logs via libosmocore logging. More... | |
struct osmo_stats_reporter * | osmo_stats_reporter_create_statsd (const char *name) |
Create a stats_reporter reporting to statsd. More... | |
int | osmo_stats_reporter_send (struct osmo_stats_reporter *srep, const char *data, int data_len) |
int | osmo_stats_reporter_send_buffer (struct osmo_stats_reporter *srep) |
int | osmo_stats_reporter_udp_open (struct osmo_stats_reporter *srep) |
int | osmo_stats_reporter_udp_close (struct osmo_stats_reporter *srep) |
static | LLIST_HEAD (osmo_stats_reporter_list) |
static int | osmo_stats_reporter_log_send_counter (struct osmo_stats_reporter *srep, const struct rate_ctr_group *ctrg, const struct rate_ctr_desc *desc, int64_t value, int64_t delta) |
static int | osmo_stats_reporter_log_send_item (struct osmo_stats_reporter *srep, const struct osmo_stat_item_group *statg, const struct osmo_stat_item_desc *desc, int64_t value) |
static int | update_srep_config (struct osmo_stats_reporter *srep) |
static int | osmo_stats_timer_cb (struct osmo_fd *ofd, unsigned int what) |
static int | start_timer () |
static int | osmo_stats_reporter_log_send (struct osmo_stats_reporter *srep, const char *type, const char *name1, unsigned int index1, const char *name2, int value, const char *unit) |
static int | osmo_stats_reporter_check_config (struct osmo_stats_reporter *srep, unsigned int index, int class_id) |
static int | osmo_stats_reporter_send_counter (struct osmo_stats_reporter *srep, const struct rate_ctr_group *ctrg, const struct rate_ctr_desc *desc, int64_t value, int64_t delta) |
static int | rate_ctr_handler (struct rate_ctr_group *ctrg, struct rate_ctr *ctr, const struct rate_ctr_desc *desc, void *sctx_) |
static int | rate_ctr_group_handler (struct rate_ctr_group *ctrg, void *sctx_) |
static int | osmo_stats_reporter_send_item (struct osmo_stats_reporter *srep, const struct osmo_stat_item_group *statg, const struct osmo_stat_item_desc *desc, int32_t value) |
static int | osmo_stat_item_handler (struct osmo_stat_item_group *statg, struct osmo_stat_item *item, void *sctx_) |
static int | osmo_stat_item_group_handler (struct osmo_stat_item_group *statg, void *sctx_) |
static int | handle_counter (struct osmo_counter *counter, void *sctx_) |
static void | flush_all_reporters () |
static int | osmo_stats_reporter_statsd_send_counter (struct osmo_stats_reporter *srep, const struct rate_ctr_group *ctrg, const struct rate_ctr_desc *desc, int64_t value, int64_t delta) |
static int | osmo_stats_reporter_statsd_send_item (struct osmo_stats_reporter *srep, const struct osmo_stat_item_group *statg, const struct osmo_stat_item_desc *desc, int64_t value) |
static void | osmo_stats_reporter_sanitize_name (char *buf) |
static int | osmo_stats_reporter_statsd_send (struct osmo_stats_reporter *srep, const char *name1, unsigned int index1, const char *name2, int64_t value, const char *unit) |
void | vty_out_stat_item_group (struct vty *vty, const char *prefix, struct osmo_stat_item_group *statg) |
Variables | |
OSMO_STATS_CLASS_UNKNOWN | |
OSMO_STATS_CLASS_GLOBAL | |
OSMO_STATS_CLASS_PEER | |
OSMO_STATS_CLASS_SUBSCRIBER | |
OSMO_STATS_REPORTER_LOG | |
OSMO_STATS_REPORTER_STATSD | |
struct osmo_stats_config * | osmo_stats_config |
static void * | osmo_stats_ctx |
static int | is_initialised |
static int32_t | current_stat_item_index |
static struct osmo_stats_config | s_stats_config |
struct osmo_stats_config * | osmo_stats_config |
static struct osmo_fd | osmo_stats_timer |
struct osmo_stats_config * | osmo_stats_config |
static void * | osmo_stats_ctx = NULL |
static int | is_initialised = 0 |
static int32_t | current_stat_item_index = 0 |
static struct osmo_stats_config | s_stats_config |
struct osmo_stats_config * | osmo_stats_config = &s_stats_config |
static struct osmo_fd | osmo_stats_timer = { .fd = -1 } |
This module implements periodic reporting of statistics / counters.
It supports the notion of multiple osmo_stats_reporter objects which independently of each other can report statistics at different configurable intervals to different destinations.
In order to use this facility, you have to call osmo_stats_init() once at application start-up and then create one or more osmo_stats_reporter, either using the direct API functions or by using the optional VTY bindings:
You can either use the above API functions directly to create osmo_stats_reporter instances, or you can use the VTY support contained in libosmovty. See the "stats" configuration node installed by osmo_stats_vty_Add_cmds().
An osmo_stats_reporter reports statistics on all of the following libosmocore internal counter/statistics objects:
You do not need to do anything in particular to expose a given counter or stat_item, they are all exported automatically via any osmo_stats_reporter. If you have multiple osmo_stats_reporter, they will each report all counters/stat_items.
#define STATS_DEFAULT_BUFLEN 256 |
Referenced by osmo_stats_reporter_disable().
#define STATS_DEFAULT_INTERVAL 5 /* secs */ |
enum osmo_stats_class |
|
static |
Referenced by osmo_stat_item_handler(), osmo_stats_init(), and osmo_stats_report().
|
static |
Referenced by osmo_stats_init(), osmo_stats_set_interval(), and start_timer().
struct osmo_stats_config* osmo_stats_config = &s_stats_config |
struct osmo_stats_config* osmo_stats_config |
|
static |
Referenced by osmo_stats_init(), and osmo_stats_reporter_alloc().
|
static |
|
static |