Skip to content

Commit

Permalink
Fix some legacy issues to remove job and instance labels.
Browse files Browse the repository at this point in the history
Signed-off-by: owent <[email protected]>
  • Loading branch information
owent committed Oct 3, 2023
1 parent 3517444 commit dd737e3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions exporters/prometheus/src/collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ std::vector<prometheus_client::MetricFamily> PrometheusCollector::Collect() cons

std::vector<prometheus_client::MetricFamily> result;

bool populate_target_info = populate_target_info_;
reader_->Collect([&result, populate_target_info](sdk::metrics::ResourceMetrics &metric_data) {
reader_->Collect([&result, this](sdk::metrics::ResourceMetrics &metric_data) {
auto prometheus_metric_data =
PrometheusExporterUtils::TranslateToPrometheus(metric_data, populate_target_info);
PrometheusExporterUtils::TranslateToPrometheus(metric_data, this->populate_target_info_);
for (auto &data : prometheus_metric_data)
result.emplace_back(data);
return true;
Expand Down
2 changes: 1 addition & 1 deletion exporters/prometheus/src/exporter_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ void PrometheusExporterUtils::SetMetricBasic(
// Note that attribute keys are sorted, but sanitized keys can be out-of-order.
// We could sort the sanitized keys again, but this seems too expensive to do
// in this hot code path. Instead, we ignore out-of-order keys and emit a warning.
metric.label.reserve(labels.size() + 2);
metric.label.reserve(labels.size());
std::string previous_key;
for (auto const &label : labels)
{
Expand Down

0 comments on commit dd737e3

Please sign in to comment.