Skip to content

Commit

Permalink
Addressed the review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shripad621git committed Feb 12, 2024
1 parent b6735e7 commit 454d699
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/tracing/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"); }

Expand Down
4 changes: 2 additions & 2 deletions src/tracing/esp32_trace/esp32_tracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ 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)
{
esp_diag_metrics_register("SYS_MTR" /*Tag of metrics */, label /* Unique key 8 */, label /* label displayed on dashboard */,
"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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/tracing/esp32_trace/esp32_tracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 3 additions & 5 deletions src/tracing/json/json_tracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/tracing/json/json_tracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/tracing/registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/tracing/registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 454d699

Please sign in to comment.