Closed ftc300 closed 1 year ago
@ftc300 I hope you figured this out. We will add an example that will showcase a use case with the usage of custom metrics real soon.
@vikramdattu please kindly spend time showing us how to add custom metrics and variables as well. Thank you in advanced!
Hi @dolphin22 adding a custom metric/veriable has two parts:
#include <esp_diagnostics_metric.h>`
#define TAG "heap"
#define KEY "free"
#define LABEL "amount of free heap"
#define PATH "Heap.Free"
Register a metric:
esp_diag_metrics_register(TAG, KEY, LABEL, PATH ESP_DIAG_DATA_TYPE_UINT);
// API ref
Send the data: (this can be done multiple times)
uint32_t free_heap = <code to get free heap>
esp_diag_metrics_add_uint(KEY, free heap);
I have shown the example to add metrics, you can extend this similarly for variables. Hope this helps!
Hi @dolphin22 adding a custom metric/veriable has two parts:
- Register a metrics/veriable // one time at the start after initialising insights
- Send the data // this can be multiple times as per requirement
#include <esp_diagnostics_metric.h>` #define TAG "heap" #define KEY "free" #define LABEL "amount of free heap" #define PATH "Heap.Free"
Register a metric:
esp_diag_metrics_register(TAG, KEY, LABEL, PATH ESP_DIAG_DATA_TYPE_UINT);
// API refSend the data: (this can be done multiple times)
uint32_t free_heap = <code to get free heap> esp_diag_metrics_add_uint(KEY, free heap);
I have shown the example to add metrics, you can extend this similarly for variables. Hope this helps!
It works, thanks!
I would like to inquire about monitoring the Bluetooth connection status and how to create a custom Metric for this purpose. Could you please provide me with a demo or example on how to achieve this?