Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Increment the:
* [SEMANTIC CONVENTIONS] Upgrade to semantic conventions 1.39.0
[#3813](https://github.com/open-telemetry/opentelemetry-cpp/pull/3813)

* [CONFIGURATION] File configuration - prometheus without_target_info
[#3818](https://github.com/open-telemetry/opentelemetry-cpp/pull/3818)

Breaking changes:

* [CONFIGURATION] File configuration - remove zipkin
Expand Down
2 changes: 1 addition & 1 deletion exporters/prometheus/src/prometheus_pull_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ std::unique_ptr<opentelemetry::sdk::metrics::MetricReader> PrometheusPullBuilder
url.append(std::to_string(model->port));

options.url = url;
options.populate_target_info = true;
options.populate_target_info = !model->without_target_info;
options.without_otel_scope = model->without_scope_info;

switch (model->translation_strategy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class PrometheusPullMetricExporterConfiguration : public PullMetricExporterConfi
std::string host;
std::size_t port{0};
bool without_scope_info{false};
bool without_target_info{false};
std::unique_ptr<IncludeExcludeConfiguration> with_resource_constant_labels;
TranslationStrategy translation_strategy;
};
Expand Down
9 changes: 4 additions & 5 deletions sdk/src/configuration/configuration_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -820,11 +820,10 @@ ConfigurationParser::ParsePrometheusPullMetricExporterConfiguration(
auto model = std::make_unique<PrometheusPullMetricExporterConfiguration>();
std::unique_ptr<DocumentNode> child;

model->host = node->GetString("host", "localhost");
model->port = node->GetInteger("port", 9464);
model->without_scope_info = node->GetBoolean("without_scope_info", false);

// FIXME: without_target_info
model->host = node->GetString("host", "localhost");
model->port = node->GetInteger("port", 9464);
model->without_scope_info = node->GetBoolean("without_scope_info", false);
model->without_target_info = node->GetBoolean("without_target_info", false);

child = node->GetChildNode("with_resource_constant_labels");
if (child)
Expand Down
3 changes: 3 additions & 0 deletions sdk/test/configuration/yaml_metrics_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ file_format: "1.0-metrics"
ASSERT_EQ(prometheus->host, "localhost");
ASSERT_EQ(prometheus->port, 9464);
ASSERT_EQ(prometheus->without_scope_info, false);
ASSERT_EQ(prometheus->without_target_info, false);
ASSERT_EQ(prometheus->translation_strategy,
opentelemetry::sdk::configuration::TranslationStrategy::UnderscoreEscapingWithSuffixes);
ASSERT_EQ(prometheus->with_resource_constant_labels, nullptr);
Expand All @@ -557,6 +558,7 @@ file_format: "1.0-metrics"
host: "prometheus"
port: 1234
without_scope_info: true
without_target_info: true
translation_strategy: NoUTF8EscapingWithSuffixes
with_resource_constant_labels:
included:
Expand All @@ -582,6 +584,7 @@ file_format: "1.0-metrics"
ASSERT_EQ(prometheus->host, "prometheus");
ASSERT_EQ(prometheus->port, 1234);
ASSERT_EQ(prometheus->without_scope_info, true);
ASSERT_EQ(prometheus->without_target_info, true);
ASSERT_EQ(prometheus->translation_strategy,
opentelemetry::sdk::configuration::TranslationStrategy::NoUTF8EscapingWithSuffixes);
ASSERT_NE(prometheus->with_resource_constant_labels, nullptr);
Expand Down
Loading