diff --git a/CHANGELOG.md b/CHANGELOG.md index f12e19eebb..a770864faf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## main / unreleased -* [FEATURE] OTLP receiver: Support including scope attributes/name/version/schema URL as metric labels, via configuration parameter `otlp.convert_scope_metadata`. #16730 +* [FEATURE] OTLP receiver: Support promoting OTel scope name/version/schema URL/attributes as metric labels, enable via configuration parameter `otlp.promote_scope_metadata`. #16730 #16760 ## 3.4.2 / 2025-06-04 diff --git a/config/config.go b/config/config.go index 90d6707456..d61a1457e7 100644 --- a/config/config.go +++ b/config/config.go @@ -1562,9 +1562,9 @@ type OTLPConfig struct { TranslationStrategy translationStrategyOption `yaml:"translation_strategy,omitempty"` KeepIdentifyingResourceAttributes bool `yaml:"keep_identifying_resource_attributes,omitempty"` ConvertHistogramsToNHCB bool `yaml:"convert_histograms_to_nhcb,omitempty"` - // ConvertScopeMetadata controls whether to convert OTel scope metadata (i.e. name, version, schema URL, and attributes) to metric labels. + // PromoteScopeMetadata controls whether to promote OTel scope metadata (i.e. name, version, schema URL, and attributes) to metric labels. // As per OTel spec, the aforementioned scope metadata should be identifying, i.e. made into metric labels. - ConvertScopeMetadata bool `yaml:"convert_scope_metadata,omitempty"` + PromoteScopeMetadata bool `yaml:"promote_scope_metadata,omitempty"` } // UnmarshalYAML implements the yaml.Unmarshaler interface. diff --git a/config/config_test.go b/config/config_test.go index 8c8004982f..43ea2fcd48 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -1808,9 +1808,9 @@ func TestOTLPConvertHistogramsToNHCB(t *testing.T) { }) } -func TestOTLPConvertScopeMetadata(t *testing.T) { +func TestOTLPPromoteScopeMetadata(t *testing.T) { t.Run("good config", func(t *testing.T) { - want, err := LoadFile(filepath.Join("testdata", "otlp_convert_scope_metadata.good.yml"), false, promslog.NewNopLogger()) + want, err := LoadFile(filepath.Join("testdata", "otlp_promote_scope_metadata.good.yml"), false, promslog.NewNopLogger()) require.NoError(t, err) out, err := yaml.Marshal(want) @@ -1818,7 +1818,7 @@ func TestOTLPConvertScopeMetadata(t *testing.T) { var got Config require.NoError(t, yaml.UnmarshalStrict(out, &got)) - require.True(t, got.OTLPConfig.ConvertScopeMetadata) + require.True(t, got.OTLPConfig.PromoteScopeMetadata) }) } diff --git a/config/testdata/otlp_convert_scope_metadata.good.yml b/config/testdata/otlp_convert_scope_metadata.good.yml deleted file mode 100644 index c596fd4a74..0000000000 --- a/config/testdata/otlp_convert_scope_metadata.good.yml +++ /dev/null @@ -1,2 +0,0 @@ -otlp: - convert_scope_metadata: true diff --git a/config/testdata/otlp_promote_scope_metadata.good.yml b/config/testdata/otlp_promote_scope_metadata.good.yml new file mode 100644 index 0000000000..d88f657abd --- /dev/null +++ b/config/testdata/otlp_promote_scope_metadata.good.yml @@ -0,0 +1,2 @@ +otlp: + promote_scope_metadata: true diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index e6626c2340..45f099af4e 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -214,9 +214,9 @@ otlp: [ keep_identifying_resource_attributes: | default = false ] # Configures optional translation of OTLP explicit bucket histograms into native histograms with custom buckets. [ convert_histograms_to_nhcb: | default = false ] - # Enables translation of OTel scope metadata (i.e. name, version, schema URL, and attributes) into metric metadata. + # Enables promotion of OTel scope metadata (i.e. name, version, schema URL, and attributes) to metric labels. # This is disabled by default for backwards compatibility, but according to OTel spec, scope metadata _should_ be identifying, i.e. translated to metric labels. - [ convert_scope_metadata: | default = false ] + [ promote_scope_metadata: | default = false ] # Settings related to the remote read feature. remote_read: diff --git a/storage/remote/otlptranslator/prometheusremotewrite/helper.go b/storage/remote/otlptranslator/prometheusremotewrite/helper.go index 1ff7436f65..630c010429 100644 --- a/storage/remote/otlptranslator/prometheusremotewrite/helper.go +++ b/storage/remote/otlptranslator/prometheusremotewrite/helper.go @@ -124,9 +124,9 @@ func createAttributes(resource pcommon.Resource, attributes pcommon.Map, scope s promotedAttrs := settings.PromoteResourceAttributes.promotedAttributes(resourceAttrs) - convertScope := settings.ConvertScopeMetadata && scope.name != "" + promoteScope := settings.PromoteScopeMetadata && scope.name != "" scopeLabelCount := 0 - if convertScope { + if promoteScope { // Include name, version and schema URL. scopeLabelCount = scope.attributes.Len() + 3 } @@ -176,7 +176,7 @@ func createAttributes(resource pcommon.Resource, attributes pcommon.Map, scope s l[normalized] = lbl.Value } } - if convertScope { + if promoteScope { l["otel_scope_name"] = scope.name l["otel_scope_version"] = scope.version l["otel_scope_schema_url"] = scope.schemaURL diff --git a/storage/remote/otlptranslator/prometheusremotewrite/helper_test.go b/storage/remote/otlptranslator/prometheusremotewrite/helper_test.go index c352dea73c..88d00ee980 100644 --- a/storage/remote/otlptranslator/prometheusremotewrite/helper_test.go +++ b/storage/remote/otlptranslator/prometheusremotewrite/helper_test.go @@ -68,16 +68,16 @@ func TestCreateAttributes(t *testing.T) { scope scope promoteAllResourceAttributes bool promoteResourceAttributes []string - convertScope bool + promoteScope bool ignoreResourceAttributes []string ignoreAttrs []string expectedLabels []prompb.Label }{ { - name: "Successful conversion without resource attribute promotion and without scope conversion", + name: "Successful conversion without resource attribute promotion and without scope promotion", scope: defaultScope, promoteResourceAttributes: nil, - convertScope: false, + promoteScope: false, expectedLabels: []prompb.Label{ { Name: "__name__", @@ -102,10 +102,10 @@ func TestCreateAttributes(t *testing.T) { }, }, { - name: "Successful conversion without resource attribute promotion and with scope conversion", + name: "Successful conversion without resource attribute promotion and with scope promotion", scope: defaultScope, promoteResourceAttributes: nil, - convertScope: true, + promoteScope: true, expectedLabels: []prompb.Label{ { Name: "__name__", @@ -150,10 +150,10 @@ func TestCreateAttributes(t *testing.T) { }, }, { - name: "Successful conversion without resource attribute promotion and with scope conversion, but without scope", + name: "Successful conversion without resource attribute promotion and with scope promotion, but without scope", scope: scope{}, promoteResourceAttributes: nil, - convertScope: true, + promoteScope: true, expectedLabels: []prompb.Label{ { Name: "__name__", @@ -178,10 +178,10 @@ func TestCreateAttributes(t *testing.T) { }, }, { - name: "Successful conversion with some attributes ignored and with scope conversion", + name: "Successful conversion with some attributes ignored and with scope promotion", scope: defaultScope, promoteResourceAttributes: nil, - convertScope: true, + promoteScope: true, ignoreAttrs: []string{"metric-attr-other"}, expectedLabels: []prompb.Label{ { @@ -223,10 +223,10 @@ func TestCreateAttributes(t *testing.T) { }, }, { - name: "Successful conversion with resource attribute promotion and with scope conversion", + name: "Successful conversion with resource attribute promotion and with scope promotion", scope: defaultScope, promoteResourceAttributes: []string{"non-existent-attr", "existent-attr"}, - convertScope: true, + promoteScope: true, expectedLabels: []prompb.Label{ { Name: "__name__", @@ -275,10 +275,10 @@ func TestCreateAttributes(t *testing.T) { }, }, { - name: "Successful conversion with resource attribute promotion and with scope conversion, conflicting resource attributes are ignored", + name: "Successful conversion with resource attribute promotion and with scope promotion, conflicting resource attributes are ignored", scope: defaultScope, promoteResourceAttributes: []string{"non-existent-attr", "existent-attr", "metric-attr", "job", "instance"}, - convertScope: true, + promoteScope: true, expectedLabels: []prompb.Label{ { Name: "__name__", @@ -327,10 +327,10 @@ func TestCreateAttributes(t *testing.T) { }, }, { - name: "Successful conversion with resource attribute promotion and with scope conversion, attributes are only promoted once", + name: "Successful conversion with resource attribute promotion and with scope promotion, attributes are only promoted once", scope: defaultScope, promoteResourceAttributes: []string{"existent-attr", "existent-attr"}, - convertScope: true, + promoteScope: true, expectedLabels: []prompb.Label{ { Name: "__name__", @@ -379,10 +379,10 @@ func TestCreateAttributes(t *testing.T) { }, }, { - name: "Successful conversion promoting all resource attributes and with scope conversion", + name: "Successful conversion promoting all resource attributes and with scope promotion", scope: defaultScope, promoteAllResourceAttributes: true, - convertScope: true, + promoteScope: true, expectedLabels: []prompb.Label{ { Name: "__name__", @@ -439,10 +439,10 @@ func TestCreateAttributes(t *testing.T) { }, }, { - name: "Successful conversion promoting all resource attributes and with scope conversion, ignoring 'service.instance.id'", + name: "Successful conversion promoting all resource attributes and with scope promotion, ignoring 'service.instance.id'", scope: defaultScope, promoteAllResourceAttributes: true, - convertScope: true, + promoteScope: true, ignoreResourceAttributes: []string{ "service.instance.id", }, @@ -506,7 +506,7 @@ func TestCreateAttributes(t *testing.T) { PromoteResourceAttributes: tc.promoteResourceAttributes, IgnoreResourceAttributes: tc.ignoreResourceAttributes, }), - ConvertScopeMetadata: tc.convertScope, + PromoteScopeMetadata: tc.promoteScope, } lbls := createAttributes(resource, attrs, tc.scope, settings, tc.ignoreAttrs, false, model.MetricNameLabel, "test_metric") @@ -551,11 +551,11 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) { name string metric func() pmetric.Metric scope scope - convertScope bool + promoteScope bool want func() map[uint64]*prompb.TimeSeries }{ { - name: "summary with start time and without scope conversion", + name: "summary with start time and without scope promotion", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_summary") @@ -568,7 +568,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) { return metric }, scope: defaultScope, - convertScope: false, + promoteScope: false, want: func() map[uint64]*prompb.TimeSeries { countLabels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_summary" + countStr}, @@ -602,7 +602,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) { }, }, { - name: "summary with start time and with scope conversion", + name: "summary with start time and with scope promotion", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_summary") @@ -615,7 +615,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) { return metric }, scope: defaultScope, - convertScope: true, + promoteScope: true, want: func() map[uint64]*prompb.TimeSeries { scopeLabels := []prompb.Label{ { @@ -674,7 +674,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) { }, }, { - name: "summary without start time and without scope conversion", + name: "summary without start time and without scope promotion", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_summary") @@ -685,7 +685,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) { return metric }, - convertScope: false, + promoteScope: false, want: func() map[uint64]*prompb.TimeSeries { countLabels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_summary" + countStr}, @@ -720,7 +720,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) { metric.Summary().DataPoints(), pcommon.NewResource(), Settings{ - ConvertScopeMetadata: tt.convertScope, + PromoteScopeMetadata: tt.promoteScope, ExportCreatedMetric: true, }, metric.Name(), @@ -751,11 +751,11 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) { name string metric func() pmetric.Metric scope scope - convertScope bool + promoteScope bool want func() map[uint64]*prompb.TimeSeries }{ { - name: "histogram with start time and without scope conversion", + name: "histogram with start time and without scope promotion", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_hist") @@ -768,7 +768,7 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) { return metric }, scope: defaultScope, - convertScope: false, + promoteScope: false, want: func() map[uint64]*prompb.TimeSeries { countLabels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_hist" + countStr}, @@ -803,7 +803,7 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) { }, }, { - name: "histogram with start time and with scope conversion", + name: "histogram with start time and with scope promotion", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_hist") @@ -816,7 +816,7 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) { return metric }, scope: defaultScope, - convertScope: true, + promoteScope: true, want: func() map[uint64]*prompb.TimeSeries { scopeLabels := []prompb.Label{ { @@ -920,7 +920,7 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) { pcommon.NewResource(), Settings{ ExportCreatedMetric: true, - ConvertScopeMetadata: tt.convertScope, + PromoteScopeMetadata: tt.promoteScope, }, metric.Name(), tt.scope, diff --git a/storage/remote/otlptranslator/prometheusremotewrite/histograms_test.go b/storage/remote/otlptranslator/prometheusremotewrite/histograms_test.go index 6b3e88255f..eb8e80ee0f 100644 --- a/storage/remote/otlptranslator/prometheusremotewrite/histograms_test.go +++ b/storage/remote/otlptranslator/prometheusremotewrite/histograms_test.go @@ -636,11 +636,11 @@ func TestPrometheusConverter_addExponentialHistogramDataPoints(t *testing.T) { name string metric func() pmetric.Metric scope scope - convertScope bool + promoteScope bool wantSeries func() map[uint64]*prompb.TimeSeries }{ { - name: "histogram data points with same labels and without scope conversion", + name: "histogram data points with same labels and without scope promotion", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_hist") @@ -665,7 +665,7 @@ func TestPrometheusConverter_addExponentialHistogramDataPoints(t *testing.T) { return metric }, scope: defaultScope, - convertScope: false, + promoteScope: false, wantSeries: func() map[uint64]*prompb.TimeSeries { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_hist"}, @@ -701,7 +701,7 @@ func TestPrometheusConverter_addExponentialHistogramDataPoints(t *testing.T) { }, }, { - name: "histogram data points with same labels and with scope conversion", + name: "histogram data points with same labels and with scope promotion", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_hist") @@ -726,7 +726,7 @@ func TestPrometheusConverter_addExponentialHistogramDataPoints(t *testing.T) { return metric }, scope: defaultScope, - convertScope: true, + promoteScope: true, wantSeries: func() map[uint64]*prompb.TimeSeries { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_hist"}, @@ -767,7 +767,7 @@ func TestPrometheusConverter_addExponentialHistogramDataPoints(t *testing.T) { }, }, { - name: "histogram data points with different labels and without scope conversion", + name: "histogram data points with different labels and without scope promotion", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_hist") @@ -792,7 +792,7 @@ func TestPrometheusConverter_addExponentialHistogramDataPoints(t *testing.T) { return metric }, scope: defaultScope, - convertScope: false, + promoteScope: false, wantSeries: func() map[uint64]*prompb.TimeSeries { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_hist"}, @@ -854,7 +854,7 @@ func TestPrometheusConverter_addExponentialHistogramDataPoints(t *testing.T) { pcommon.NewResource(), Settings{ ExportCreatedMetric: true, - ConvertScopeMetadata: tt.convertScope, + PromoteScopeMetadata: tt.promoteScope, }, namer.Build(TranslatorMetricFromOtelMetric(metric)), pmetric.AggregationTemporalityCumulative, @@ -1093,11 +1093,11 @@ func TestPrometheusConverter_addCustomBucketsHistogramDataPoints(t *testing.T) { name string metric func() pmetric.Metric scope scope - convertScope bool + promoteScope bool wantSeries func() map[uint64]*prompb.TimeSeries }{ { - name: "histogram data points with same labels and without scope conversion", + name: "histogram data points with same labels and without scope promotion", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_hist_to_nhcb") @@ -1122,7 +1122,7 @@ func TestPrometheusConverter_addCustomBucketsHistogramDataPoints(t *testing.T) { return metric }, scope: defaultScope, - convertScope: false, + promoteScope: false, wantSeries: func() map[uint64]*prompb.TimeSeries { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_hist_to_nhcb"}, @@ -1158,7 +1158,7 @@ func TestPrometheusConverter_addCustomBucketsHistogramDataPoints(t *testing.T) { }, }, { - name: "histogram data points with same labels and with scope conversion", + name: "histogram data points with same labels and with scope promotion", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_hist_to_nhcb") @@ -1183,7 +1183,7 @@ func TestPrometheusConverter_addCustomBucketsHistogramDataPoints(t *testing.T) { return metric }, scope: defaultScope, - convertScope: true, + promoteScope: true, wantSeries: func() map[uint64]*prompb.TimeSeries { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_hist_to_nhcb"}, @@ -1224,7 +1224,7 @@ func TestPrometheusConverter_addCustomBucketsHistogramDataPoints(t *testing.T) { }, }, { - name: "histogram data points with different labels and without scope conversion", + name: "histogram data points with different labels and without scope promotion", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_hist_to_nhcb") @@ -1249,7 +1249,7 @@ func TestPrometheusConverter_addCustomBucketsHistogramDataPoints(t *testing.T) { return metric }, scope: defaultScope, - convertScope: false, + promoteScope: false, wantSeries: func() map[uint64]*prompb.TimeSeries { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_hist_to_nhcb"}, @@ -1312,7 +1312,7 @@ func TestPrometheusConverter_addCustomBucketsHistogramDataPoints(t *testing.T) { Settings{ ExportCreatedMetric: true, ConvertHistogramsToNHCB: true, - ConvertScopeMetadata: tt.convertScope, + PromoteScopeMetadata: tt.promoteScope, }, namer.Build(TranslatorMetricFromOtelMetric(metric)), pmetric.AggregationTemporalityCumulative, diff --git a/storage/remote/otlptranslator/prometheusremotewrite/metrics_to_prw.go b/storage/remote/otlptranslator/prometheusremotewrite/metrics_to_prw.go index 03fa8f311e..07a2809348 100644 --- a/storage/remote/otlptranslator/prometheusremotewrite/metrics_to_prw.go +++ b/storage/remote/otlptranslator/prometheusremotewrite/metrics_to_prw.go @@ -48,8 +48,8 @@ type Settings struct { KeepIdentifyingResourceAttributes bool ConvertHistogramsToNHCB bool AllowDeltaTemporality bool - // ConvertScopeMetadata controls whether to convert OTel scope metadata to metric labels. - ConvertScopeMetadata bool + // PromoteScopeMetadata controls whether to promote OTel scope metadata to metric labels. + PromoteScopeMetadata bool } // PrometheusConverter converts from OTel write format to Prometheus remote write format. diff --git a/storage/remote/otlptranslator/prometheusremotewrite/number_data_points_test.go b/storage/remote/otlptranslator/prometheusremotewrite/number_data_points_test.go index 969765c631..dfe0a810c8 100644 --- a/storage/remote/otlptranslator/prometheusremotewrite/number_data_points_test.go +++ b/storage/remote/otlptranslator/prometheusremotewrite/number_data_points_test.go @@ -46,11 +46,11 @@ func TestPrometheusConverter_addGaugeNumberDataPoints(t *testing.T) { name string metric func() pmetric.Metric scope scope - convertScope bool + promoteScope bool want func() map[uint64]*prompb.TimeSeries }{ { - name: "gauge without scope conversion", + name: "gauge without scope promotion", metric: func() pmetric.Metric { return getIntGaugeMetric( "test", @@ -59,7 +59,7 @@ func TestPrometheusConverter_addGaugeNumberDataPoints(t *testing.T) { ) }, scope: defaultScope, - convertScope: false, + promoteScope: false, want: func() map[uint64]*prompb.TimeSeries { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test"}, @@ -78,7 +78,7 @@ func TestPrometheusConverter_addGaugeNumberDataPoints(t *testing.T) { }, }, { - name: "gauge with scope conversion", + name: "gauge with scope promotion", metric: func() pmetric.Metric { return getIntGaugeMetric( "test", @@ -87,7 +87,7 @@ func TestPrometheusConverter_addGaugeNumberDataPoints(t *testing.T) { ) }, scope: defaultScope, - convertScope: true, + promoteScope: true, want: func() map[uint64]*prompb.TimeSeries { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test"}, @@ -122,7 +122,7 @@ func TestPrometheusConverter_addGaugeNumberDataPoints(t *testing.T) { pcommon.NewResource(), Settings{ ExportCreatedMetric: true, - ConvertScopeMetadata: tt.convertScope, + PromoteScopeMetadata: tt.promoteScope, }, metric.Name(), tt.scope, @@ -151,11 +151,11 @@ func TestPrometheusConverter_addSumNumberDataPoints(t *testing.T) { name string metric func() pmetric.Metric scope scope - convertScope bool + promoteScope bool want func() map[uint64]*prompb.TimeSeries }{ { - name: "sum without scope conversion", + name: "sum without scope promotion", metric: func() pmetric.Metric { return getIntSumMetric( "test", @@ -165,7 +165,7 @@ func TestPrometheusConverter_addSumNumberDataPoints(t *testing.T) { ) }, scope: defaultScope, - convertScope: false, + promoteScope: false, want: func() map[uint64]*prompb.TimeSeries { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test"}, @@ -184,7 +184,7 @@ func TestPrometheusConverter_addSumNumberDataPoints(t *testing.T) { }, }, { - name: "sum with scope conversion", + name: "sum with scope promotion", metric: func() pmetric.Metric { return getIntSumMetric( "test", @@ -194,7 +194,7 @@ func TestPrometheusConverter_addSumNumberDataPoints(t *testing.T) { ) }, scope: defaultScope, - convertScope: true, + promoteScope: true, want: func() map[uint64]*prompb.TimeSeries { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test"}, @@ -218,7 +218,7 @@ func TestPrometheusConverter_addSumNumberDataPoints(t *testing.T) { }, }, { - name: "sum with exemplars and without scope conversion", + name: "sum with exemplars and without scope promotion", metric: func() pmetric.Metric { m := getIntSumMetric( "test", @@ -230,7 +230,7 @@ func TestPrometheusConverter_addSumNumberDataPoints(t *testing.T) { return m }, scope: defaultScope, - convertScope: false, + promoteScope: false, want: func() map[uint64]*prompb.TimeSeries { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test"}, @@ -250,7 +250,7 @@ func TestPrometheusConverter_addSumNumberDataPoints(t *testing.T) { }, }, { - name: "monotonic cumulative sum with start timestamp and without scope conversion", + name: "monotonic cumulative sum with start timestamp and without scope promotion", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_sum") @@ -265,7 +265,7 @@ func TestPrometheusConverter_addSumNumberDataPoints(t *testing.T) { return metric }, scope: defaultScope, - convertScope: false, + promoteScope: false, want: func() map[uint64]*prompb.TimeSeries { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_sum"}, @@ -290,7 +290,7 @@ func TestPrometheusConverter_addSumNumberDataPoints(t *testing.T) { }, }, { - name: "monotonic cumulative sum with no start time and without scope conversion", + name: "monotonic cumulative sum with no start time and without scope promotion", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_sum") @@ -303,7 +303,7 @@ func TestPrometheusConverter_addSumNumberDataPoints(t *testing.T) { return metric }, scope: defaultScope, - convertScope: false, + promoteScope: false, want: func() map[uint64]*prompb.TimeSeries { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_sum"}, @@ -319,7 +319,7 @@ func TestPrometheusConverter_addSumNumberDataPoints(t *testing.T) { }, }, { - name: "non-monotonic cumulative sum with start time and without scope conversion", + name: "non-monotonic cumulative sum with start time and without scope promotion", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_sum") @@ -332,7 +332,7 @@ func TestPrometheusConverter_addSumNumberDataPoints(t *testing.T) { return metric }, scope: defaultScope, - convertScope: false, + promoteScope: false, want: func() map[uint64]*prompb.TimeSeries { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_sum"}, @@ -360,7 +360,7 @@ func TestPrometheusConverter_addSumNumberDataPoints(t *testing.T) { metric, Settings{ ExportCreatedMetric: true, - ConvertScopeMetadata: tt.convertScope, + PromoteScopeMetadata: tt.promoteScope, }, metric.Name(), tt.scope, diff --git a/storage/remote/write_handler.go b/storage/remote/write_handler.go index 53c35ccb42..fa760f0b49 100644 --- a/storage/remote/write_handler.go +++ b/storage/remote/write_handler.go @@ -596,7 +596,7 @@ func (rw *rwExporter) ConsumeMetrics(ctx context.Context, md pmetric.Metrics) er KeepIdentifyingResourceAttributes: otlpCfg.KeepIdentifyingResourceAttributes, ConvertHistogramsToNHCB: otlpCfg.ConvertHistogramsToNHCB, AllowDeltaTemporality: rw.allowDeltaTemporality, - ConvertScopeMetadata: otlpCfg.ConvertScopeMetadata, + PromoteScopeMetadata: otlpCfg.PromoteScopeMetadata, }) if err != nil { rw.logger.Warn("Error translating OTLP metrics to Prometheus write request", "err", err)