From 789262507a54165149ffb4cd14fd706bbf904f3a Mon Sep 17 00:00:00 2001 From: Arthur Silva Sens Date: Thu, 7 May 2026 15:44:26 -0300 Subject: [PATCH 1/5] Implement scope_info_enabled Signed-off-by: Arthur Silva Sens --- opentelemetry-prometheus/Cargo.toml | 2 +- opentelemetry-prometheus/src/config.rs | 43 +++++-- opentelemetry-prometheus/src/lib.rs | 113 +++++++++--------- .../data/conflict_help_two_counters_1.txt | 8 +- .../data/conflict_help_two_counters_2.txt | 8 +- .../data/conflict_help_two_histograms_1.txt | 76 ++++++------ .../data/conflict_help_two_histograms_2.txt | 76 ++++++------ .../conflict_help_two_updowncounters_1.txt | 8 +- .../conflict_help_two_updowncounters_2.txt | 8 +- ...flict_type_counter_and_updowncounter_1.txt | 5 +- ...flict_type_counter_and_updowncounter_2.txt | 5 +- ...ict_type_histogram_and_updowncounter_1.txt | 5 +- ...ict_type_histogram_and_updowncounter_2.txt | 39 +++--- .../tests/data/conflict_unit_two_counters.txt | 8 +- .../data/conflict_unit_two_histograms.txt | 76 ++++++------ .../data/conflict_unit_two_updowncounters.txt | 8 +- .../tests/data/counter.txt | 7 +- .../tests/data/counter_disabled_suffix.txt | 7 +- .../tests/data/custom_resource.txt | 5 +- .../tests/data/empty_resource.txt | 5 +- opentelemetry-prometheus/tests/data/gauge.txt | 5 +- .../tests/data/histogram.txt | 29 ++--- .../tests/data/multi_scopes.txt | 8 +- .../tests/data/no_conflict_two_counters.txt | 8 +- .../tests/data/no_conflict_two_histograms.txt | 76 ++++++------ .../data/no_conflict_two_updowncounters.txt | 8 +- .../tests/data/resource_in_every_metrics.txt | 5 +- .../tests/data/sanitized_labels.txt | 5 +- .../tests/data/sanitized_names.txt | 41 +++---- .../data/select_resource_in_every_metrics.txt | 5 +- .../tests/data/with_namespace.txt | 5 +- .../tests/data/without_target_info.txt | 5 +- .../tests/integration_test.rs | 72 ++++++++++- 33 files changed, 378 insertions(+), 406 deletions(-) diff --git a/opentelemetry-prometheus/Cargo.toml b/opentelemetry-prometheus/Cargo.toml index 118eed06f0..26cfbbba24 100644 --- a/opentelemetry-prometheus/Cargo.toml +++ b/opentelemetry-prometheus/Cargo.toml @@ -22,7 +22,7 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] once_cell = { workspace = true } opentelemetry = { workspace = true, features = ["metrics", "internal-logs"] } -opentelemetry_sdk = { workspace = true, features = ["metrics", "experimental_metrics_custom_reader"] } +opentelemetry_sdk = { workspace = true, features = ["metrics", "experimental_metrics_custom_reader", "spec_unstable_metrics_views"] } prometheus = { version = "0.14", default-features = false } tracing = { workspace = true, optional = true } # optional for opentelemetry internal logging diff --git a/opentelemetry-prometheus/src/config.rs b/opentelemetry-prometheus/src/config.rs index b520acdeb0..726bb5701f 100644 --- a/opentelemetry-prometheus/src/config.rs +++ b/opentelemetry-prometheus/src/config.rs @@ -6,18 +6,32 @@ use std::sync::{Arc, Mutex}; use crate::{Collector, PrometheusExporter, ResourceSelector}; /// [PrometheusExporter] configuration options -#[derive(Default)] pub struct ExporterBuilder { registry: Option, disable_target_info: bool, without_units: bool, without_counter_suffixes: bool, namespace: Option, - disable_scope_info: bool, + scope_info_enabled: bool, reader: ManualReaderBuilder, resource_selector: ResourceSelector, } +impl Default for ExporterBuilder { + fn default() -> Self { + ExporterBuilder { + registry: None, + disable_target_info: false, + without_units: false, + without_counter_suffixes: false, + namespace: None, + scope_info_enabled: true, + reader: ManualReaderBuilder::default(), + resource_selector: ResourceSelector::default(), + } + } +} + impl fmt::Debug for ExporterBuilder { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("ExporterBuilder") @@ -26,7 +40,7 @@ impl fmt::Debug for ExporterBuilder { .field("without_units", &self.without_units) .field("without_counter_suffixes", &self.without_counter_suffixes) .field("namespace", &self.namespace) - .field("disable_scope_info", &self.disable_scope_info) + .field("scope_info_enabled", &self.scope_info_enabled) .finish() } } @@ -66,20 +80,27 @@ impl ExporterBuilder { self } - /// Configures the exporter to not export the `otel_scope_info` metric. + /// Configures whether to export instrumentation scope labels on metric points. + /// + /// If not specified, scope info is enabled and the exporter adds + /// `otel_scope_*` labels to all metric points. + pub fn scope_info_enabled(mut self, enabled: bool) -> Self { + self.scope_info_enabled = enabled; + self + } + + /// Configures the exporter to not export instrumentation scope labels on metric points. /// - /// If not specified, the exporter will create a `otel_scope_info` metric - /// containing the metrics' Instrumentation Scope, and also add labels about - /// Instrumentation Scope to all metric points. + /// Deprecated: use [`scope_info_enabled(false)`](Self::scope_info_enabled) instead. pub fn without_scope_info(mut self) -> Self { - self.disable_scope_info = true; + self.scope_info_enabled = false; self } /// Configures the exporter to prefix metrics with the given namespace. /// - /// Metrics such as `target_info` and `otel_scope_info` are not prefixed since - /// these have special behavior based on their name. + /// Metrics such as `target_info` are not prefixed since these have special + /// behavior based on their name. pub fn with_namespace(mut self, namespace: impl Into) -> Self { let mut namespace = namespace.into(); @@ -123,7 +144,7 @@ impl ExporterBuilder { disable_target_info: self.disable_target_info, without_units: self.without_units, without_counter_suffixes: self.without_counter_suffixes, - disable_scope_info: self.disable_scope_info, + scope_info_enabled: self.scope_info_enabled, create_target_info_once: OnceCell::new(), namespace: self.namespace, inner: Mutex::new(Default::default()), diff --git a/opentelemetry-prometheus/src/lib.rs b/opentelemetry-prometheus/src/lib.rs index 63abac9741..6406fd52fb 100644 --- a/opentelemetry-prometheus/src/lib.rs +++ b/opentelemetry-prometheus/src/lib.rs @@ -65,9 +65,6 @@ //! // a_histogram_bucket{key="value",otel_scope_name="my-app",le="+Inf"} 1 //! // a_histogram_sum{key="value",otel_scope_name="my-app"} 100 //! // a_histogram_count{key="value",otel_scope_name="my-app"} 1 -//! // # HELP otel_scope_info Instrumentation Scope metadata -//! // # TYPE otel_scope_info gauge -//! // otel_scope_info{otel_scope_name="my-app"} 1 //! // # HELP target_info Target metadata //! // # TYPE target_info gauge //! // target_info{service_name="unknown_service"} 1 @@ -114,10 +111,15 @@ use std::{fmt, sync::Weak}; const TARGET_INFO_NAME: &str = "target_info"; const TARGET_INFO_DESCRIPTION: &str = "Target metadata"; -const SCOPE_INFO_METRIC_NAME: &str = "otel_scope_info"; -const SCOPE_INFO_DESCRIPTION: &str = "Instrumentation Scope metadata"; - -const SCOPE_INFO_KEYS: [&str; 2] = ["otel_scope_name", "otel_scope_version"]; +const SCOPE_NAME_LABEL: &str = "otel_scope_name"; +const SCOPE_VERSION_LABEL: &str = "otel_scope_version"; +const SCOPE_SCHEMA_URL_LABEL: &str = "otel_scope_schema_url"; +const SCOPE_ATTRIBUTE_PREFIX: &str = "otel_scope_"; +const RESERVED_SCOPE_LABELS: [&str; 3] = [ + SCOPE_NAME_LABEL, + SCOPE_VERSION_LABEL, + SCOPE_SCHEMA_URL_LABEL, +]; // prometheus counters MUST have a _total suffix by default: // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/compatibility/prometheus_and_openmetrics.md @@ -170,7 +172,7 @@ struct Collector { disable_target_info: bool, without_units: bool, without_counter_suffixes: bool, - disable_scope_info: bool, + scope_info_enabled: bool, create_target_info_once: OnceCell, resource_labels_once: OnceCell>, namespace: Option, @@ -180,7 +182,6 @@ struct Collector { #[derive(Default)] struct CollectorInner { - scope_infos: HashMap, metric_families: HashMap, } @@ -301,27 +302,8 @@ impl prometheus::core::Collector for Collector { .get_or_init(|| self.resource_selector.select(metrics.resource())); for scope_metrics in metrics.scope_metrics() { - let scope_labels = if !self.disable_scope_info { - if scope_metrics.scope().attributes().count() > 0 { - let scope_info = inner - .scope_infos - .entry(scope_metrics.scope().clone()) - .or_insert_with_key(create_scope_info_metric); - res.push(scope_info.clone()); - } - - let mut labels = - Vec::with_capacity(1 + scope_metrics.scope().version().is_some() as usize); - let mut name = LabelPair::default(); - name.set_name(SCOPE_INFO_KEYS[0].into()); - name.set_value(scope_metrics.scope().name().to_string()); - labels.push(name); - if let Some(version) = &scope_metrics.scope().version() { - let mut l_version = LabelPair::default(); - l_version.set_name(SCOPE_INFO_KEYS[1].into()); - l_version.set_value(version.to_string()); - labels.push(l_version); - } + let scope_labels = if self.scope_info_enabled { + let mut labels = get_scope_labels(scope_metrics.scope()); if !resource_labels.is_empty() { labels.extend(resource_labels.iter().cloned()); @@ -422,6 +404,49 @@ fn get_attrs(kvs: &mut dyn Iterator, extra: &[LabelPair]) res } +fn get_scope_labels(scope: &InstrumentationScope) -> Vec { + let mut labels = Vec::with_capacity( + 1 + scope.version().is_some() as usize + + scope.schema_url().is_some() as usize + + scope.attributes().count(), + ); + labels.push(label_pair(SCOPE_NAME_LABEL, scope.name())); + + if let Some(version) = scope.version() { + labels.push(label_pair(SCOPE_VERSION_LABEL, version)); + } + + if let Some(schema_url) = scope.schema_url() { + labels.push(label_pair(SCOPE_SCHEMA_URL_LABEL, schema_url)); + } + + let mut attr_labels = BTreeMap::>::new(); + for kv in scope.attributes() { + let label_name = utils::sanitize_prom_kv(&format!("{SCOPE_ATTRIBUTE_PREFIX}{}", kv.key)); + if RESERVED_SCOPE_LABELS.contains(&label_name.as_str()) { + continue; + } + attr_labels + .entry(label_name) + .and_modify(|values| values.push(kv.value.to_string())) + .or_insert_with(|| vec![kv.value.to_string()]); + } + + for (label_name, mut values) in attr_labels { + values.sort_unstable(); + labels.push(label_pair(label_name, values.join(";"))); + } + + labels +} + +fn label_pair(name: impl Into, value: impl Into) -> LabelPair { + let mut label = LabelPair::default(); + label.set_name(name.into()); + label.set_value(value.into()); + label +} + fn validate_metrics( name: &str, description: &str, @@ -585,34 +610,6 @@ fn create_info_metric( mf } -fn create_scope_info_metric(scope: &InstrumentationScope) -> MetricFamily { - let mut g = prometheus::proto::Gauge::default(); - g.set_value(1.0); - - let mut labels = Vec::with_capacity(1 + scope.version().is_some() as usize); - let mut name = LabelPair::default(); - name.set_name(SCOPE_INFO_KEYS[0].into()); - name.set_value(scope.name().to_string()); - labels.push(name); - if let Some(version) = &scope.version() { - let mut v_label = LabelPair::default(); - v_label.set_name(SCOPE_INFO_KEYS[1].into()); - v_label.set_value(version.to_string()); - labels.push(v_label); - } - - let mut m = prometheus::proto::Metric::default(); - m.set_label(labels); - m.set_gauge(g); - - let mut mf = MetricFamily::default(); - mf.set_name(SCOPE_INFO_METRIC_NAME.into()); - mf.set_help(SCOPE_INFO_DESCRIPTION.into()); - mf.set_field_type(MetricType::GAUGE); - mf.set_metric(vec![m]); - mf -} - trait Numeric: fmt::Debug { // lossy at large values for u64 and i64 but prometheus only handles floats fn as_f64(&self) -> f64; diff --git a/opentelemetry-prometheus/tests/data/conflict_help_two_counters_1.txt b/opentelemetry-prometheus/tests/data/conflict_help_two_counters_1.txt index 843e43ba53..e5d2b17122 100644 --- a/opentelemetry-prometheus/tests/data/conflict_help_two_counters_1.txt +++ b/opentelemetry-prometheus/tests/data/conflict_help_two_counters_1.txt @@ -1,11 +1,7 @@ # HELP bar_bytes_total meter a bar # TYPE bar_bytes_total counter -bar_bytes_total{type="bar",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -bar_bytes_total{type="bar",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_total{type="bar",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +bar_bytes_total{type="bar",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/conflict_help_two_counters_2.txt b/opentelemetry-prometheus/tests/data/conflict_help_two_counters_2.txt index 61c55238dc..604d8c0e39 100644 --- a/opentelemetry-prometheus/tests/data/conflict_help_two_counters_2.txt +++ b/opentelemetry-prometheus/tests/data/conflict_help_two_counters_2.txt @@ -1,11 +1,7 @@ # HELP bar_bytes_total meter b bar # TYPE bar_bytes_total counter -bar_bytes_total{type="bar",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -bar_bytes_total{type="bar",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_total{type="bar",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +bar_bytes_total{type="bar",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/conflict_help_two_histograms_1.txt b/opentelemetry-prometheus/tests/data/conflict_help_two_histograms_1.txt index ca3780ecdc..863d0f993b 100644 --- a/opentelemetry-prometheus/tests/data/conflict_help_two_histograms_1.txt +++ b/opentelemetry-prometheus/tests/data/conflict_help_two_histograms_1.txt @@ -1,45 +1,41 @@ # HELP bar_bytes meter a bar # TYPE bar_bytes histogram -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="0"} 0 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="5"} 0 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="10"} 0 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="25"} 0 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="50"} 0 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="75"} 0 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="100"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="250"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="500"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="750"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="1000"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="2500"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="5000"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="7500"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="10000"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="+Inf"} 1 -bar_bytes_sum{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -bar_bytes_count{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="0"} 0 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="5"} 0 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="10"} 0 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="25"} 0 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="50"} 0 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="75"} 0 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="100"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="250"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="500"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="750"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="1000"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="2500"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="5000"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="7500"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="10000"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="+Inf"} 1 -bar_bytes_sum{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 -bar_bytes_count{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="0"} 0 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5"} 0 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10"} 0 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="25"} 0 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="50"} 0 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="75"} 0 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="100"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="250"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="500"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="750"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="1000"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="2500"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5000"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="7500"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10000"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="+Inf"} 1 +bar_bytes_sum{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +bar_bytes_count{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="0"} 0 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5"} 0 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10"} 0 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="25"} 0 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="50"} 0 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="75"} 0 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="100"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="250"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="500"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="750"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="1000"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="2500"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5000"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="7500"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10000"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="+Inf"} 1 +bar_bytes_sum{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +bar_bytes_count{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/conflict_help_two_histograms_2.txt b/opentelemetry-prometheus/tests/data/conflict_help_two_histograms_2.txt index 939d7da091..471e9f52ad 100644 --- a/opentelemetry-prometheus/tests/data/conflict_help_two_histograms_2.txt +++ b/opentelemetry-prometheus/tests/data/conflict_help_two_histograms_2.txt @@ -1,45 +1,41 @@ # HELP bar_bytes meter b bar # TYPE bar_bytes histogram -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="0"} 0 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="5"} 0 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="10"} 0 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="25"} 0 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="50"} 0 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="75"} 0 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="100"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="250"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="500"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="750"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="1000"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="2500"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="5000"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="7500"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="10000"} 1 -bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="+Inf"} 1 -bar_bytes_sum{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -bar_bytes_count{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="0"} 0 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="5"} 0 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="10"} 0 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="25"} 0 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="50"} 0 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="75"} 0 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="100"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="250"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="500"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="750"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="1000"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="2500"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="5000"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="7500"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="10000"} 1 -bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="+Inf"} 1 -bar_bytes_sum{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 -bar_bytes_count{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="0"} 0 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5"} 0 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10"} 0 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="25"} 0 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="50"} 0 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="75"} 0 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="100"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="250"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="500"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="750"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="1000"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="2500"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5000"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="7500"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10000"} 1 +bar_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="+Inf"} 1 +bar_bytes_sum{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +bar_bytes_count{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="0"} 0 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5"} 0 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10"} 0 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="25"} 0 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="50"} 0 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="75"} 0 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="100"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="250"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="500"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="750"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="1000"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="2500"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5000"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="7500"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10000"} 1 +bar_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="+Inf"} 1 +bar_bytes_sum{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +bar_bytes_count{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/conflict_help_two_updowncounters_1.txt b/opentelemetry-prometheus/tests/data/conflict_help_two_updowncounters_1.txt index e70f86b90e..36507b2a55 100644 --- a/opentelemetry-prometheus/tests/data/conflict_help_two_updowncounters_1.txt +++ b/opentelemetry-prometheus/tests/data/conflict_help_two_updowncounters_1.txt @@ -1,11 +1,7 @@ # HELP bar_bytes meter a bar # TYPE bar_bytes gauge -bar_bytes{type="bar",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -bar_bytes{type="bar",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes{type="bar",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +bar_bytes{type="bar",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/conflict_help_two_updowncounters_2.txt b/opentelemetry-prometheus/tests/data/conflict_help_two_updowncounters_2.txt index f5f332bffe..2d8eac09cf 100644 --- a/opentelemetry-prometheus/tests/data/conflict_help_two_updowncounters_2.txt +++ b/opentelemetry-prometheus/tests/data/conflict_help_two_updowncounters_2.txt @@ -1,11 +1,7 @@ # HELP bar_bytes meter b bar # TYPE bar_bytes gauge -bar_bytes{type="bar",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -bar_bytes{type="bar",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes{type="bar",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +bar_bytes{type="bar",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/conflict_type_counter_and_updowncounter_1.txt b/opentelemetry-prometheus/tests/data/conflict_type_counter_and_updowncounter_1.txt index a9e57c8e95..9ad790d513 100644 --- a/opentelemetry-prometheus/tests/data/conflict_type_counter_and_updowncounter_1.txt +++ b/opentelemetry-prometheus/tests/data/conflict_type_counter_and_updowncounter_1.txt @@ -1,9 +1,6 @@ # HELP foo_total meter foo # TYPE foo_total counter -foo_total{type="foo",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_total{type="foo",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/conflict_type_counter_and_updowncounter_2.txt b/opentelemetry-prometheus/tests/data/conflict_type_counter_and_updowncounter_2.txt index f52fd05ca2..02c5cb50e8 100644 --- a/opentelemetry-prometheus/tests/data/conflict_type_counter_and_updowncounter_2.txt +++ b/opentelemetry-prometheus/tests/data/conflict_type_counter_and_updowncounter_2.txt @@ -1,9 +1,6 @@ # HELP foo_total meter foo # TYPE foo_total gauge -foo_total{type="foo",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_total{type="foo",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/conflict_type_histogram_and_updowncounter_1.txt b/opentelemetry-prometheus/tests/data/conflict_type_histogram_and_updowncounter_1.txt index 6ec9f665bf..391560504a 100644 --- a/opentelemetry-prometheus/tests/data/conflict_type_histogram_and_updowncounter_1.txt +++ b/opentelemetry-prometheus/tests/data/conflict_type_histogram_and_updowncounter_1.txt @@ -1,9 +1,6 @@ # HELP foo_bytes meter gauge foo # TYPE foo_bytes gauge -foo_bytes{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/conflict_type_histogram_and_updowncounter_2.txt b/opentelemetry-prometheus/tests/data/conflict_type_histogram_and_updowncounter_2.txt index 1722eb2ec6..131c6db2d2 100644 --- a/opentelemetry-prometheus/tests/data/conflict_type_histogram_and_updowncounter_2.txt +++ b/opentelemetry-prometheus/tests/data/conflict_type_histogram_and_updowncounter_2.txt @@ -1,26 +1,23 @@ # HELP foo_bytes meter histogram foo # TYPE foo_bytes histogram -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="0"} 0 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="5"} 0 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="10"} 0 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="25"} 0 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="50"} 0 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="75"} 0 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="100"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="250"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="500"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="750"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="1000"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="2500"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="5000"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="7500"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="10000"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="+Inf"} 1 -foo_bytes_sum{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -foo_bytes_count{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="0"} 0 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5"} 0 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10"} 0 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="25"} 0 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="50"} 0 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="75"} 0 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="100"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="250"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="500"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="750"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="1000"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="2500"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5000"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="7500"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10000"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="+Inf"} 1 +foo_bytes_sum{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +foo_bytes_count{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/conflict_unit_two_counters.txt b/opentelemetry-prometheus/tests/data/conflict_unit_two_counters.txt index 57546f0d79..4967652fc9 100644 --- a/opentelemetry-prometheus/tests/data/conflict_unit_two_counters.txt +++ b/opentelemetry-prometheus/tests/data/conflict_unit_two_counters.txt @@ -1,11 +1,7 @@ # HELP bar_total meter bar # TYPE bar_total counter -bar_total{type="bar",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -bar_total{type="bar",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_total{type="bar",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +bar_total{type="bar",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/conflict_unit_two_histograms.txt b/opentelemetry-prometheus/tests/data/conflict_unit_two_histograms.txt index 8774aba323..84341aa801 100644 --- a/opentelemetry-prometheus/tests/data/conflict_unit_two_histograms.txt +++ b/opentelemetry-prometheus/tests/data/conflict_unit_two_histograms.txt @@ -1,45 +1,41 @@ # HELP bar meter histogram bar # TYPE bar histogram -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="0"} 0 -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="5"} 0 -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="10"} 0 -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="25"} 0 -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="50"} 0 -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="75"} 0 -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="100"} 1 -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="250"} 1 -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="500"} 1 -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="750"} 1 -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="1000"} 1 -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="2500"} 1 -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="5000"} 1 -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="7500"} 1 -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="10000"} 1 -bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="+Inf"} 1 -bar_sum{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -bar_count{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="0"} 0 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="5"} 0 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="10"} 0 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="25"} 0 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="50"} 0 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="75"} 0 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="100"} 1 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="250"} 1 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="500"} 1 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="750"} 1 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="1000"} 1 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="2500"} 1 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="5000"} 1 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="7500"} 1 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="10000"} 1 -bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="+Inf"} 1 -bar_sum{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 -bar_count{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="0"} 0 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5"} 0 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10"} 0 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="25"} 0 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="50"} 0 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="75"} 0 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="100"} 1 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="250"} 1 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="500"} 1 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="750"} 1 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="1000"} 1 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="2500"} 1 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5000"} 1 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="7500"} 1 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10000"} 1 +bar_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="+Inf"} 1 +bar_sum{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +bar_count{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 1 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="0"} 0 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5"} 0 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10"} 0 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="25"} 0 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="50"} 0 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="75"} 0 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="100"} 1 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="250"} 1 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="500"} 1 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="750"} 1 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="1000"} 1 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="2500"} 1 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5000"} 1 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="7500"} 1 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10000"} 1 +bar_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="+Inf"} 1 +bar_sum{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +bar_count{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/conflict_unit_two_updowncounters.txt b/opentelemetry-prometheus/tests/data/conflict_unit_two_updowncounters.txt index 5365cff9ce..1c6e14f16d 100644 --- a/opentelemetry-prometheus/tests/data/conflict_unit_two_updowncounters.txt +++ b/opentelemetry-prometheus/tests/data/conflict_unit_two_updowncounters.txt @@ -1,11 +1,7 @@ # HELP bar meter gauge bar # TYPE bar gauge -bar{type="bar",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -bar{type="bar",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar{type="bar",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +bar{type="bar",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/counter.txt b/opentelemetry-prometheus/tests/data/counter.txt index 053aba6e80..51361f01d3 100644 --- a/opentelemetry-prometheus/tests/data/counter.txt +++ b/opentelemetry-prometheus/tests/data/counter.txt @@ -1,10 +1,7 @@ # HELP foo_milliseconds_total a simple counter # TYPE foo_milliseconds_total counter -foo_milliseconds_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 -foo_milliseconds_total{A="D",C="B",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 5 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +foo_milliseconds_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 24.3 +foo_milliseconds_total{A="D",C="B",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 5 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/counter_disabled_suffix.txt b/opentelemetry-prometheus/tests/data/counter_disabled_suffix.txt index c59a78e452..c34d675e55 100755 --- a/opentelemetry-prometheus/tests/data/counter_disabled_suffix.txt +++ b/opentelemetry-prometheus/tests/data/counter_disabled_suffix.txt @@ -1,10 +1,7 @@ # HELP foo_milliseconds a simple counter without a total suffix # TYPE foo_milliseconds counter -foo_milliseconds{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 -foo_milliseconds{A="D",C="B",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 5 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +foo_milliseconds{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 24.3 +foo_milliseconds{A="D",C="B",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 5 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/custom_resource.txt b/opentelemetry-prometheus/tests/data/custom_resource.txt index 200c8a1bc8..e5ff34a627 100644 --- a/opentelemetry-prometheus/tests/data/custom_resource.txt +++ b/opentelemetry-prometheus/tests/data/custom_resource.txt @@ -1,9 +1,6 @@ # HELP foo_total a simple counter # TYPE foo_total counter -foo_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +foo_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 24.3 # HELP target_info Target metadata # TYPE target_info gauge target_info{A="B",C="D",service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/empty_resource.txt b/opentelemetry-prometheus/tests/data/empty_resource.txt index 69f0e83668..47dc815613 100644 --- a/opentelemetry-prometheus/tests/data/empty_resource.txt +++ b/opentelemetry-prometheus/tests/data/empty_resource.txt @@ -1,6 +1,3 @@ # HELP foo_total a simple counter # TYPE foo_total counter -foo_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +foo_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 24.3 diff --git a/opentelemetry-prometheus/tests/data/gauge.txt b/opentelemetry-prometheus/tests/data/gauge.txt index c37ca8d33d..f75f7bc4a1 100644 --- a/opentelemetry-prometheus/tests/data/gauge.txt +++ b/opentelemetry-prometheus/tests/data/gauge.txt @@ -1,9 +1,6 @@ # HELP bar_ratio a fun little gauge # TYPE bar_ratio gauge -bar_ratio{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 0.75 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +bar_ratio{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 0.75 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/histogram.txt b/opentelemetry-prometheus/tests/data/histogram.txt index 490e49c7a5..bf31ec3662 100644 --- a/opentelemetry-prometheus/tests/data/histogram.txt +++ b/opentelemetry-prometheus/tests/data/histogram.txt @@ -1,21 +1,18 @@ # HELP histogram_baz_bytes a very nice histogram # TYPE histogram_baz_bytes histogram -histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="0"} 0 -histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="5"} 0 -histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="10"} 1 -histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="25"} 2 -histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="50"} 2 -histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="75"} 2 -histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="100"} 2 -histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="250"} 4 -histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="500"} 4 -histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="1000"} 4 -histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="+Inf"} 4 -histogram_baz_bytes_sum{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 236 -histogram_baz_bytes_count{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 4 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="0"} 0 +histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5"} 0 +histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10"} 1 +histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="25"} 2 +histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="50"} 2 +histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="75"} 2 +histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="100"} 2 +histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="250"} 4 +histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="500"} 4 +histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="1000"} 4 +histogram_baz_bytes_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="+Inf"} 4 +histogram_baz_bytes_sum{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 236 +histogram_baz_bytes_count{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 4 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/multi_scopes.txt b/opentelemetry-prometheus/tests/data/multi_scopes.txt index e910457c2a..422208c079 100644 --- a/opentelemetry-prometheus/tests/data/multi_scopes.txt +++ b/opentelemetry-prometheus/tests/data/multi_scopes.txt @@ -1,13 +1,9 @@ # HELP bar_milliseconds_total meter bar counter # TYPE bar_milliseconds_total counter -bar_milliseconds_total{type="bar",otel_scope_name="meterbar",otel_scope_version="v0.1.0"} 200 +bar_milliseconds_total{type="bar",otel_scope_name="meterbar",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 200 # HELP foo_milliseconds_total meter foo counter # TYPE foo_milliseconds_total counter -foo_milliseconds_total{type="foo",otel_scope_name="meterfoo",otel_scope_version="v0.1.0"} 100 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="meterbar",otel_scope_version="v0.1.0"} 1 -otel_scope_info{otel_scope_name="meterfoo",otel_scope_version="v0.1.0"} 1 +foo_milliseconds_total{type="foo",otel_scope_name="meterfoo",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/no_conflict_two_counters.txt b/opentelemetry-prometheus/tests/data/no_conflict_two_counters.txt index 55f6c4965f..47988182cf 100644 --- a/opentelemetry-prometheus/tests/data/no_conflict_two_counters.txt +++ b/opentelemetry-prometheus/tests/data/no_conflict_two_counters.txt @@ -1,11 +1,7 @@ # HELP foo_bytes_total meter counter foo # TYPE foo_bytes_total counter -foo_bytes_total{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -foo_bytes_total{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +foo_bytes_total{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +foo_bytes_total{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/no_conflict_two_histograms.txt b/opentelemetry-prometheus/tests/data/no_conflict_two_histograms.txt index 634ad5e2de..d5251a324a 100644 --- a/opentelemetry-prometheus/tests/data/no_conflict_two_histograms.txt +++ b/opentelemetry-prometheus/tests/data/no_conflict_two_histograms.txt @@ -1,45 +1,41 @@ # HELP foo_bytes meter histogram foo # TYPE foo_bytes histogram -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="0"} 0 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="5"} 0 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="10"} 0 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="25"} 0 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="50"} 0 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="75"} 0 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="100"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="250"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="500"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="750"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="1000"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="2500"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="5000"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="7500"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="10000"} 1 -foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",le="+Inf"} 1 -foo_bytes_sum{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -foo_bytes_count{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="0"} 0 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="5"} 0 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="10"} 0 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="25"} 0 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="50"} 0 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="75"} 0 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="100"} 1 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="250"} 1 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="500"} 1 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="750"} 1 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="1000"} 1 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="2500"} 1 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="5000"} 1 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="7500"} 1 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="10000"} 1 -foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",le="+Inf"} 1 -foo_bytes_sum{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 -foo_bytes_count{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="0"} 0 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5"} 0 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10"} 0 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="25"} 0 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="50"} 0 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="75"} 0 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="100"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="250"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="500"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="750"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="1000"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="2500"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5000"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="7500"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10000"} 1 +foo_bytes_bucket{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="+Inf"} 1 +foo_bytes_sum{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +foo_bytes_count{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 1 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="0"} 0 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5"} 0 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10"} 0 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="25"} 0 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="50"} 0 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="75"} 0 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="100"} 1 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="250"} 1 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="500"} 1 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="750"} 1 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="1000"} 1 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="2500"} 1 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5000"} 1 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="7500"} 1 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10000"} 1 +foo_bytes_bucket{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="+Inf"} 1 +foo_bytes_sum{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +foo_bytes_count{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/no_conflict_two_updowncounters.txt b/opentelemetry-prometheus/tests/data/no_conflict_two_updowncounters.txt index 17b7262096..30f4184185 100644 --- a/opentelemetry-prometheus/tests/data/no_conflict_two_updowncounters.txt +++ b/opentelemetry-prometheus/tests/data/no_conflict_two_updowncounters.txt @@ -1,11 +1,7 @@ # HELP foo_bytes meter gauge foo # TYPE foo_bytes gauge -foo_bytes{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 -foo_bytes{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 -otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +foo_bytes{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 +foo_bytes{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/resource_in_every_metrics.txt b/opentelemetry-prometheus/tests/data/resource_in_every_metrics.txt index a788c09f09..6a02f96aeb 100644 --- a/opentelemetry-prometheus/tests/data/resource_in_every_metrics.txt +++ b/opentelemetry-prometheus/tests/data/resource_in_every_metrics.txt @@ -1,9 +1,6 @@ # HELP bar_ratio a fun little gauge # TYPE bar_ratio gauge -bar_ratio{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +bar_ratio{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/sanitized_labels.txt b/opentelemetry-prometheus/tests/data/sanitized_labels.txt index 79ec70e61f..a02c33d4e2 100644 --- a/opentelemetry-prometheus/tests/data/sanitized_labels.txt +++ b/opentelemetry-prometheus/tests/data/sanitized_labels.txt @@ -1,9 +1,6 @@ # HELP foo_total a sanitary counter # TYPE foo_total counter -foo_total{A_B="Q",C_D="Y;Z",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +foo_total{A_B="X",C_D="Y;Z",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 24.3 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/sanitized_names.txt b/opentelemetry-prometheus/tests/data/sanitized_names.txt index 5a2f337b1f..e9ffcaf98d 100644 --- a/opentelemetry-prometheus/tests/data/sanitized_names.txt +++ b/opentelemetry-prometheus/tests/data/sanitized_names.txt @@ -1,35 +1,24 @@ -# HELP _0invalid_counter_name_total a counter with an invalid name -# TYPE _0invalid_counter_name_total counter -_0invalid_counter_name_total{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 100 # HELP bar a fun little gauge # TYPE bar gauge -bar{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 75 +bar{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 75 # HELP invalid_gauge_name a gauge with an invalid name # TYPE invalid_gauge_name gauge -invalid_gauge_name{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 100 +invalid_gauge_name{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 100 # HELP invalid_hist_name a histogram with an invalid name # TYPE invalid_hist_name histogram -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="0"} 0 -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="5"} 0 -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="10"} 0 -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="25"} 1 -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="50"} 1 -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="75"} 1 -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="100"} 1 -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="250"} 1 -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="500"} 1 -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="750"} 1 -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="1000"} 1 -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="2500"} 1 -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="5000"} 1 -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="7500"} 1 -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="10000"} 1 -invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",le="+Inf"} 1 -invalid_hist_name_sum{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 23 -invalid_hist_name_count{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="0"} 0 +invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="5"} 0 +invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="10"} 0 +invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="25"} 1 +invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="50"} 1 +invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="75"} 1 +invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="100"} 1 +invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="250"} 1 +invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="500"} 1 +invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="1000"} 1 +invalid_hist_name_bucket{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",le="+Inf"} 1 +invalid_hist_name_sum{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 23 +invalid_hist_name_count{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/select_resource_in_every_metrics.txt b/opentelemetry-prometheus/tests/data/select_resource_in_every_metrics.txt index 23570fe69d..e91650ff23 100644 --- a/opentelemetry-prometheus/tests/data/select_resource_in_every_metrics.txt +++ b/opentelemetry-prometheus/tests/data/select_resource_in_every_metrics.txt @@ -1,9 +1,6 @@ # HELP bar_ratio a fun little gauge # TYPE bar_ratio gauge -bar_ratio{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",service_name="prometheus_test"} 1 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +bar_ratio{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v",service_name="prometheus_test"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/opentelemetry-prometheus/tests/data/with_namespace.txt b/opentelemetry-prometheus/tests/data/with_namespace.txt index 0d3b10f712..7b35f1cfed 100644 --- a/opentelemetry-prometheus/tests/data/with_namespace.txt +++ b/opentelemetry-prometheus/tests/data/with_namespace.txt @@ -1,9 +1,6 @@ -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 # HELP test_foo_total a simple counter # TYPE test_foo_total counter -test_foo_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 +test_foo_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 24.3 diff --git a/opentelemetry-prometheus/tests/data/without_target_info.txt b/opentelemetry-prometheus/tests/data/without_target_info.txt index 69f0e83668..47dc815613 100644 --- a/opentelemetry-prometheus/tests/data/without_target_info.txt +++ b/opentelemetry-prometheus/tests/data/without_target_info.txt @@ -1,6 +1,3 @@ # HELP foo_total a simple counter # TYPE foo_total counter -foo_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 -# HELP otel_scope_info Instrumentation Scope metadata -# TYPE otel_scope_info gauge -otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +foo_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_k="v"} 24.3 diff --git a/opentelemetry-prometheus/tests/integration_test.rs b/opentelemetry-prometheus/tests/integration_test.rs index c2c407b975..35cd98baa1 100644 --- a/opentelemetry-prometheus/tests/integration_test.rs +++ b/opentelemetry-prometheus/tests/integration_test.rs @@ -20,6 +20,65 @@ const BYTES_BOUNDARIES: &[f64] = &[ 10000.0, ]; +#[test] +fn scope_info_labels_are_added_to_metric_points() { + let registry = prometheus::Registry::new(); + let exporter = ExporterBuilder::default() + .with_registry(registry.clone()) + .build() + .unwrap(); + let provider = SdkMeterProvider::builder().with_reader(exporter).build(); + + let scope = InstrumentationScope::builder("scope-test") + .with_version("v1.2.3") + .with_schema_url("https://opentelemetry.io/schemas/1.0.0") + .with_attributes([ + KeyValue::new("custom.scope.attr", "scope-value"), + KeyValue::new("version", "reserved-version"), + KeyValue::new("schema_url", "reserved-schema-url"), + ]) + .build(); + let meter = provider.meter_with_scope(scope); + + let counter = meter.u64_counter("scope.counter").build(); + counter.add(1, &[KeyValue::new("metric.attr", "metric-value")]); + + let output = gather_and_encode(registry); + + assert!(output.contains( + r#"scope_counter_total{metric_attr="metric-value",otel_scope_name="scope-test",otel_scope_version="v1.2.3",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_custom_scope_attr="scope-value"} 1"# + )); + assert!(!output.contains("otel_scope_info")); + assert!(!output.contains("reserved-version")); + assert!(!output.contains("reserved-schema-url")); +} + +#[test] +fn scope_info_labels_can_be_disabled() { + let registry = prometheus::Registry::new(); + let exporter = ExporterBuilder::default() + .scope_info_enabled(false) + .with_registry(registry.clone()) + .build() + .unwrap(); + let provider = SdkMeterProvider::builder().with_reader(exporter).build(); + + let scope = InstrumentationScope::builder("scope-test") + .with_version("v1.2.3") + .with_schema_url("https://opentelemetry.io/schemas/1.0.0") + .with_attributes([KeyValue::new("custom.scope.attr", "scope-value")]) + .build(); + let meter = provider.meter_with_scope(scope); + + let counter = meter.u64_counter("scope.counter").build(); + counter.add(1, &[KeyValue::new("metric.attr", "metric-value")]); + + let output = gather_and_encode(registry); + + assert!(output.contains(r#"scope_counter_total{metric_attr="metric-value"} 1"#)); + assert!(!output.contains("otel_scope_")); +} + #[ignore = "https://github.com/open-telemetry/opentelemetry-rust/pull/2224"] #[test] fn prometheus_exporter_integration() { @@ -394,15 +453,18 @@ fn prometheus_exporter_integration() { } fn gather_and_compare(registry: prometheus::Registry, expected: String, name: &'static str) { + let expected = get_platform_specific_string(expected); + let output_string = get_platform_specific_string(gather_and_encode(registry)); + + assert_eq!(output_string, expected, "{name}"); +} + +fn gather_and_encode(registry: prometheus::Registry) -> String { let mut output = Vec::new(); let encoder = TextEncoder::new(); let metric_families = registry.gather(); encoder.encode(&metric_families, &mut output).unwrap(); - - let expected = get_platform_specific_string(expected); - let output_string = get_platform_specific_string(String::from_utf8(output).unwrap()); - - assert_eq!(output_string, expected, "{name}"); + String::from_utf8(output).unwrap() } /// Returns a String which uses the platform specific new line feed character. From 623c1257fc913a258832bf238534ea28a007e9ac Mon Sep 17 00:00:00 2001 From: Arthur Silva Sens Date: Mon, 8 Jun 2026 14:53:56 -0300 Subject: [PATCH 2/5] Address feedback Signed-off-by: Arthur Silva Sens --- opentelemetry-prometheus/Cargo.toml | 2 +- opentelemetry-prometheus/src/config.rs | 8 -------- opentelemetry-prometheus/src/lib.rs | 3 +-- opentelemetry-prometheus/tests/integration_test.rs | 9 +++++---- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/opentelemetry-prometheus/Cargo.toml b/opentelemetry-prometheus/Cargo.toml index c0975e1483..ba813e9b41 100644 --- a/opentelemetry-prometheus/Cargo.toml +++ b/opentelemetry-prometheus/Cargo.toml @@ -25,7 +25,7 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] once_cell = { workspace = true } opentelemetry = { workspace = true, features = ["metrics", "internal-logs"] } -opentelemetry_sdk = { workspace = true, features = ["metrics", "experimental_metrics_custom_reader", "spec_unstable_metrics_views"] } +opentelemetry_sdk = { workspace = true, features = ["metrics", "experimental_metrics_custom_reader"] } prometheus = { version = "0.14", default-features = false } tracing = { workspace = true, optional = true } # optional for opentelemetry internal logging diff --git a/opentelemetry-prometheus/src/config.rs b/opentelemetry-prometheus/src/config.rs index 726bb5701f..dfd9ada615 100644 --- a/opentelemetry-prometheus/src/config.rs +++ b/opentelemetry-prometheus/src/config.rs @@ -89,14 +89,6 @@ impl ExporterBuilder { self } - /// Configures the exporter to not export instrumentation scope labels on metric points. - /// - /// Deprecated: use [`scope_info_enabled(false)`](Self::scope_info_enabled) instead. - pub fn without_scope_info(mut self) -> Self { - self.scope_info_enabled = false; - self - } - /// Configures the exporter to prefix metrics with the given namespace. /// /// Metrics such as `target_info` are not prefixed since these have special diff --git a/opentelemetry-prometheus/src/lib.rs b/opentelemetry-prometheus/src/lib.rs index 6406fd52fb..84ef3b2c17 100644 --- a/opentelemetry-prometheus/src/lib.rs +++ b/opentelemetry-prometheus/src/lib.rs @@ -432,8 +432,7 @@ fn get_scope_labels(scope: &InstrumentationScope) -> Vec { .or_insert_with(|| vec![kv.value.to_string()]); } - for (label_name, mut values) in attr_labels { - values.sort_unstable(); + for (label_name, values) in attr_labels { labels.push(label_pair(label_name, values.join(";"))); } diff --git a/opentelemetry-prometheus/tests/integration_test.rs b/opentelemetry-prometheus/tests/integration_test.rs index 35cd98baa1..bc6f8b8e4e 100644 --- a/opentelemetry-prometheus/tests/integration_test.rs +++ b/opentelemetry-prometheus/tests/integration_test.rs @@ -33,7 +33,8 @@ fn scope_info_labels_are_added_to_metric_points() { .with_version("v1.2.3") .with_schema_url("https://opentelemetry.io/schemas/1.0.0") .with_attributes([ - KeyValue::new("custom.scope.attr", "scope-value"), + KeyValue::new("custom.scope.attr", "first"), + KeyValue::new("custom/scope/attr", "second"), KeyValue::new("version", "reserved-version"), KeyValue::new("schema_url", "reserved-schema-url"), ]) @@ -46,7 +47,7 @@ fn scope_info_labels_are_added_to_metric_points() { let output = gather_and_encode(registry); assert!(output.contains( - r#"scope_counter_total{metric_attr="metric-value",otel_scope_name="scope-test",otel_scope_version="v1.2.3",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_custom_scope_attr="scope-value"} 1"# + r#"scope_counter_total{metric_attr="metric-value",otel_scope_name="scope-test",otel_scope_version="v1.2.3",otel_scope_schema_url="https://opentelemetry.io/schemas/1.0.0",otel_scope_custom_scope_attr="first;second"} 1"# )); assert!(!output.contains("otel_scope_info")); assert!(!output.contains("reserved-version")); @@ -321,7 +322,7 @@ fn prometheus_exporter_integration() { }, TestCase { name: "without scope_info", - builder: ExporterBuilder::default().without_scope_info(), + builder: ExporterBuilder::default().scope_info_enabled(false), expected_file: "without_scope_info.txt", record_metrics: Box::new(|meter| { let attrs = vec![KeyValue::new("A", "B"), KeyValue::new("C", "D")]; @@ -338,7 +339,7 @@ fn prometheus_exporter_integration() { TestCase { name: "without scope_info and target_info", builder: ExporterBuilder::default() - .without_scope_info() + .scope_info_enabled(false) .without_target_info(), expected_file: "without_scope_and_target_info.txt", record_metrics: Box::new(|meter| { From 979a0d4aaa667bdca7fcb7252d5e0a118d9a868c Mon Sep 17 00:00:00 2001 From: Arthur Silva Sens Date: Mon, 8 Jun 2026 14:54:17 -0300 Subject: [PATCH 3/5] Add changelog entry Signed-off-by: Arthur Silva Sens --- opentelemetry-prometheus/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opentelemetry-prometheus/CHANGELOG.md b/opentelemetry-prometheus/CHANGELOG.md index a34cfce8e2..2335b09c42 100644 --- a/opentelemetry-prometheus/CHANGELOG.md +++ b/opentelemetry-prometheus/CHANGELOG.md @@ -2,6 +2,8 @@ ## vNext +- Add `scope_info_enabled` to configure Prometheus instrumentation scope labels and stop exporting `otel_scope_info`. [#3503](https://github.com/open-telemetry/opentelemetry-rust/pull/3503) + ## 0.32.0 Released 2026-May-08 From b77e988bfa4f4e6ceeb073dbfac53bae538f45cf Mon Sep 17 00:00:00 2001 From: Arthur Silva Sens Date: Tue, 9 Jun 2026 10:36:54 -0300 Subject: [PATCH 4/5] Improve changelog entry Signed-off-by: Arthur Silva Sens --- opentelemetry-prometheus/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opentelemetry-prometheus/CHANGELOG.md b/opentelemetry-prometheus/CHANGELOG.md index 2335b09c42..fe0536c12b 100644 --- a/opentelemetry-prometheus/CHANGELOG.md +++ b/opentelemetry-prometheus/CHANGELOG.md @@ -2,7 +2,7 @@ ## vNext -- Add `scope_info_enabled` to configure Prometheus instrumentation scope labels and stop exporting `otel_scope_info`. [#3503](https://github.com/open-telemetry/opentelemetry-rust/pull/3503) +- Add `scope_info_enabled` to configure Prometheus instrumentation scope labels. Before this change, the exporter emitted an `otel_scope_info` metric and only added `otel_scope_name`/`otel_scope_version` labels to metric points. Now scope info is enabled by default on metric points with `otel_scope_name`, `otel_scope_version`, `otel_scope_schema_url`, and scope attributes prefixed with `otel_scope_`; setting `scope_info_enabled(false)` suppresses those labels. [#3503](https://github.com/open-telemetry/opentelemetry-rust/pull/3503) ## 0.32.0 From 41d9db6f9bb639007332408aee97ab9897ed1a39 Mon Sep 17 00:00:00 2001 From: Arthur Silva Sens Date: Tue, 9 Jun 2026 12:12:57 -0300 Subject: [PATCH 5/5] Improve changelog Signed-off-by: Arthur Silva Sens --- opentelemetry-prometheus/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opentelemetry-prometheus/CHANGELOG.md b/opentelemetry-prometheus/CHANGELOG.md index fe0536c12b..986e22b543 100644 --- a/opentelemetry-prometheus/CHANGELOG.md +++ b/opentelemetry-prometheus/CHANGELOG.md @@ -2,7 +2,7 @@ ## vNext -- Add `scope_info_enabled` to configure Prometheus instrumentation scope labels. Before this change, the exporter emitted an `otel_scope_info` metric and only added `otel_scope_name`/`otel_scope_version` labels to metric points. Now scope info is enabled by default on metric points with `otel_scope_name`, `otel_scope_version`, `otel_scope_schema_url`, and scope attributes prefixed with `otel_scope_`; setting `scope_info_enabled(false)` suppresses those labels. [#3503](https://github.com/open-telemetry/opentelemetry-rust/pull/3503) +- Replace `without_scope_info` with `scope_info_enabled` to configure Prometheus instrumentation scope labels, inverting the option from disabling scope info to enabling it. Before this change, the exporter emitted an `otel_scope_info` metric and only added `otel_scope_name`/`otel_scope_version` labels to metric points. Now scope info is enabled by default on metric points with `otel_scope_name`, `otel_scope_version`, `otel_scope_schema_url`, and scope attributes prefixed with `otel_scope_`; setting `scope_info_enabled(false)` suppresses those labels. [#3503](https://github.com/open-telemetry/opentelemetry-rust/pull/3503) ## 0.32.0