|
Modbus Vault v1.0
|
Implementation of the metrics. More...
Macros | |
| #define | AS_STRING(id, str) str, |
Functions | |
| static void | metrics_increment_stat_helper (metrics_stat_t stat) |
| Increment a metric counter. | |
| static void | on_error_callback (const event_bus_t *event_ptr, void *ctx) |
| Callback on error. | |
| esp_err_t | metrics_init (void) |
| Initialize metrics. | |
| esp_err_t | metrics_get_snapshot (uint32_t *buf_ptr, size_t buf_length, uint16_t *copied_length) |
| Get a snapshot of current system metrics. | |
| void | metrics_log_all (void) |
| Logs metrics stats through ESP logging facilities. | |
| void | metrics_reset_all (void) |
| Resets metrics counters to zero. | |
| const char * | metrics_stat_to_string (metrics_stat_t stat) |
| Gets metric state name. | |
Variables | |
| static const char * | TAG = "METRICS" |
| static uint32_t | system_metrics [METRICS_STAT_MAX] = {0} |
Implementation of the metrics.
| #define AS_STRING | ( | id, | |
| str | |||
| ) | str, |
Extract stat name from table
| esp_err_t metrics_get_snapshot | ( | uint32_t * | buf_ptr, |
| size_t | buf_length, | ||
| uint16_t * | copied_length | ||
| ) |
Get a snapshot of current system metrics.
Get a snapshot of current system metrics by copying stats to user provided buffer it's length has to be equal to metric stat maximum length and same counters used type (e.g. uint32_t)
| buf_ptr | Pointer to a buffer |
| buf_length | Length of the buffer |
| copied_length | Pointer to assign copied length by function |
| ESP_OK | Metrics copy success |
| ESP_ERR_INVALID_ARG | Provided invalid argument(s) |
|
static |
Increment a metric counter.
| stat | Stat to increment |
| esp_err_t metrics_init | ( | void | ) |
Initialize metrics.
Initialize metrics counters to zero and subscribe to event bus to collect different system stats
| ESP_OK | Initialize success |
| ESP_ERR_NO_MEM | Subscription fails |
| const char * metrics_stat_to_string | ( | metrics_stat_t | stat | ) |
Gets metric state name.
| stat | Metric stat |
Stat names list
|
static |
Callback on error.
Increment received event corresponding stat
| event_ptr | Pointer to event |
| ctx | Pointer to event context |
|
static |
Metrics counters structure
|
static |
Metrics TAG name