Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dashpole committed Sep 18, 2023
1 parent 7d4e882 commit 3dc902c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions exporters/prometheus/src/exporter_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -276,25 +276,24 @@ void PrometheusExporterUtils::SetMetricBasic(
size_t i = 0;
if (!labels.empty())
{
metric.label.resize(labels.size());
metric.label.reserve(labels.size() + 2);
for (auto const &label : labels)
{
auto sanitized = SanitizeNames(label.first);
metric.label[i].name = sanitized;
metric.label[i++].value = AttributeValueToString(label.second);
}
}
if (!scope) return;
auto scope_name = scope->GetName();
if (!scope_name.empty())
{
metric.label.resize(i + 1);
metric.label[i].name = "otel_scope_name";
metric.label[i++].value = scope_name;
}
auto scope_version = scope->GetVersion();
if (!scope_version.empty())
{
metric.label.resize(i + 1);
metric.label[i].name = "otel_scope_version";
metric.label[i++].value = scope_version;
}
Expand Down

0 comments on commit 3dc902c

Please sign in to comment.