- This change has been introduced for better management of metrics and variables hierarchy
- A metric or variable is now uniquely identified by a combination of tag and key, instead of just the key. eg. heap.free instead of free.
- The APIs also have similar changes, since tag is now required to be passed. e.g.,
// Existing APIs: esp_err_t esp_diag_metrics_add_int(const char *key, int32_t i); esp_err_t esp_diag_variable_add_int(const char *key, int32_t i); // Updated APIs(Please note the extra parameter `tag`): esp_err_t esp_diag_metrics_report_int(const char *tag, const char *key, int32_t i); esp_err_t esp_diag_variable_report_int(const char *tag, const char *key, int32_t i);
- Please refer respective header files for new API description
Note that this is a breaking change. Once you move a node to use metadata 2.0, the metrics screen will stop showing the older data reported.
- To avoid this breakage, moving to 2.0 is currently optional and developers can continue using older metadata format.
Component config > ESP Insights > Use older metadata format (1.0)
- Using metdata 2.0 is disabled by default in the SDK, but enabled in all examples. It is strongly recommended to move to 2.0, since the subsequent features (like runtime enabling of metrics, variable, etc.)