diff --git a/src/tracing/backend.h b/src/tracing/backend.h index 2217a34f2466df..c57e97ddd27638 100644 --- a/src/tracing/backend.h +++ b/src/tracing/backend.h @@ -64,7 +64,7 @@ class Backend : public ::chip::IntrusiveListNodeBase<> virtual void TraceInstant(const char * label, const char * group) {} virtual void TraceCounter(const char * label) {} - virtual void TraceMetric(const char * label, int value) {} + virtual void TraceMetric(const char * label, int32_t value) {} virtual void LogMessageSend(MessageSendInfo &) { TraceInstant("MessageSent", "Messaging"); } virtual void LogMessageReceived(MessageReceivedInfo &) { TraceInstant("MessageReceived", "Messaging"); } diff --git a/src/tracing/esp32_trace/esp32_tracing.cpp b/src/tracing/esp32_trace/esp32_tracing.cpp index 5f755269f002f3..6193587be49c7d 100644 --- a/src/tracing/esp32_trace/esp32_tracing.cpp +++ b/src/tracing/esp32_trace/esp32_tracing.cpp @@ -154,7 +154,7 @@ void ESP32Backend::TraceCounter(const char * label) ::Insights::ESPInsightsCounter::GetInstance(label)->ReportMetrics(); } -void ESP32Backend::TraceMetric(const char * label, int value) +void ESP32Backend::TraceMetric(const char * label, int32_t value) { if (!mRegistered) { @@ -162,7 +162,7 @@ void ESP32Backend::TraceMetric(const char * label, int value) "insights.mtr" /* hierarchical path */, ESP_DIAG_DATA_TYPE_INT /* data_type */); mRegistered = true; } - ESP_LOGI("mtr", "The value of %s is %d ", label, value); + ESP_LOGI("mtr", "The value of %s is %ld ", label, value); esp_diag_metrics_add_int(label, value); } diff --git a/src/tracing/esp32_trace/esp32_tracing.h b/src/tracing/esp32_trace/esp32_tracing.h index a85547e93e7ac1..3eb127c1d3367f 100644 --- a/src/tracing/esp32_trace/esp32_tracing.h +++ b/src/tracing/esp32_trace/esp32_tracing.h @@ -29,7 +29,7 @@ class ESP32Backend : public ::chip::Tracing::Backend void TraceInstant(const char * label, const char * group) override; void TraceCounter(const char * label) override; - void TraceMetric(const char * label, int value) override; + void TraceMetric(const char * label, int32_t value) override; void LogMessageSend(MessageSendInfo &) override; void LogMessageReceived(MessageReceivedInfo &) override; diff --git a/src/tracing/json/json_tracing.cpp b/src/tracing/json/json_tracing.cpp index edd8b1b53009ee..64627f079d04dd 100644 --- a/src/tracing/json/json_tracing.cpp +++ b/src/tracing/json/json_tracing.cpp @@ -295,13 +295,11 @@ void JsonBackend::TraceCounter(const char * label) OutputValue(value); } -void JsonBackend::TraceMetric(const char * label, int val) +void JsonBackend::TraceMetric(const char * label, int32_t val) { ::Json::Value value; - value["label"] = label; - value["label_value"] = val; - - // Output the metric + value["label"] = label; + value["value"] = val; OutputValue(value); } diff --git a/src/tracing/json/json_tracing.h b/src/tracing/json/json_tracing.h index 0674690a252d3f..e8ad8ee5894b03 100644 --- a/src/tracing/json/json_tracing.h +++ b/src/tracing/json/json_tracing.h @@ -52,7 +52,7 @@ class JsonBackend : public ::chip::Tracing::Backend void TraceEnd(const char * label, const char * group) override; void TraceInstant(const char * label, const char * group) override; void TraceCounter(const char * label) override; - void TraceMetric(const char * label, int val) override; + void TraceMetric(const char * label, int32_t val) override; void LogMessageSend(MessageSendInfo &) override; void LogMessageReceived(MessageReceivedInfo &) override; void LogNodeLookup(NodeLookupInfo &) override; diff --git a/src/tracing/registry.cpp b/src/tracing/registry.cpp index 18b15063be9f25..ee46b542e7f5f2 100644 --- a/src/tracing/registry.cpp +++ b/src/tracing/registry.cpp @@ -84,7 +84,7 @@ void Counter(const char * label) } } -void Metric(const char * label, int value) +void Metric(const char * label, int32_t value) { for (auto & backend : gTracingBackends) { diff --git a/src/tracing/registry.h b/src/tracing/registry.h index c27962ebad8ef5..5f3b3c1a6cea84 100644 --- a/src/tracing/registry.h +++ b/src/tracing/registry.h @@ -77,7 +77,7 @@ void Begin(const char * label, const char * group); void End(const char * label, const char * group); void Instant(const char * label, const char * group); void Counter(const char * label); -void Metric(const char * label, int value); +void Metric(const char * label, int32_t value); void LogMessageSend(::chip::Tracing::MessageSendInfo & info); void LogMessageReceived(::chip::Tracing::MessageReceivedInfo & info);