Skip to content

Commit

Permalink
Populate target_info with every scrape
Browse files Browse the repository at this point in the history
Signed-off-by: owent <[email protected]>
  • Loading branch information
owent committed Oct 1, 2023
1 parent d0f15f2 commit bb62f0a
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions exporters/prometheus/src/collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,8 @@ std::vector<prometheus_client::MetricFamily> PrometheusCollector::Collect() cons
collection_lock_.lock();

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

// If populate_target_info_ is true, populate target_info once.
bool populate_target_info = false;
if (populate_target_info_)
{
populate_target_info = true;

const_cast<PrometheusCollector *>(this)->populate_target_info_ = false;
}


bool populate_target_info = populate_target_info_;
reader_->Collect([&result, populate_target_info](sdk::metrics::ResourceMetrics &metric_data) {
auto prometheus_metric_data =
PrometheusExporterUtils::TranslateToPrometheus(metric_data, populate_target_info);
Expand Down

0 comments on commit bb62f0a

Please sign in to comment.