Skip to content

Commit

Permalink
Add environment variable to disable Prometheus populate_target_info o…
Browse files Browse the repository at this point in the history
…ption
  • Loading branch information
timwoj committed Dec 13, 2023
1 parent 28c26e2 commit fe7eca7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion exporters/prometheus/src/exporter_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,21 @@ inline bool GetPrometheusPopulateOtelScope()
return exists ? setting : true;
}

inline bool GetPrometheusPopulateTargetInfo()
{
constexpr char kPrometheusPopulateTargetInfo[] = "PROMETHEUS_EXPORTER_POPULATE_TARGET_INFO";

bool setting;
auto exists = opentelemetry::sdk::common::GetBoolEnvironmentVariable(
kPrometheusPopulateTargetInfo, setting);

return exists ? setting : true;
}

PrometheusExporterOptions::PrometheusExporterOptions()
: url(GetPrometheusDefaultHttpEndpoint()), populate_otel_scope(GetPrometheusPopulateOtelScope())
: url(GetPrometheusDefaultHttpEndpoint()),
populate_target_info(GetPrometheusPopulateTargetInfo()),
populate_otel_scope(GetPrometheusPopulateOtelScope())
{}

} // namespace metrics
Expand Down

0 comments on commit fe7eca7

Please sign in to comment.