|
Modbus Vault v1.0
|
System-wide metrics/telemetry module. More...
#include "esp_err.h"#include "stdint.h"Go to the source code of this file.
Macros | |
| #define | METRICS_TABLE(ENTRY) |
| Metrics table. | |
| #define | AS_ENUM(id, str) id, |
Enumerations | |
| enum | metrics_stat_t { METRICS_STAT_RS485_DRIVER_OVERFLOW_ERRORS , METRICS_STAT_RS485_DRIVER_PARITY_ERRORS , METRICS_STAT_MODBUS_CRC_ERRORS , METRICS_STAT_MODBUS_OVERFLOW_ERRORS , METRICS_STAT_MODBUS_NO_MEM_ERRORS , METRICS_STAT_TELEMETRY_PUBLISH_ERRORS , METRICS_STAT_LOGGER_WRITE_ERRORS , METRICS_STAT_MAX } |
| Metrics stats Enums. More... | |
Functions | |
| 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. | |
System-wide metrics/telemetry module.
| #define AS_ENUM | ( | id, | |
| str | |||
| ) | id, |
Extract stat ID from table
| #define METRICS_TABLE | ( | ENTRY | ) |
Metrics table.
| enum metrics_stat_t |
Metrics stats Enums.
| 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) |
| 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