diff --git a/.chloggen/deprecate-created-metric-beta2stable.yaml b/.chloggen/deprecate-created-metric-beta2stable.yaml new file mode 100644 index 000000000000..8d3c3e8f9429 --- /dev/null +++ b/.chloggen/deprecate-created-metric-beta2stable.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: exporter/prometheusremotewrite + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Change `exporter.prometheusremotewriteexporter.deprecateCreatedMetric` feature gate from Beta to Stable version. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [35003] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: The `export_created_metric` configuration parameter is now permanently deprecated. + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/pkg/translator/prometheusremotewrite/helper.go b/pkg/translator/prometheusremotewrite/helper.go index c2547091ee4e..13b95085d459 100644 --- a/pkg/translator/prometheusremotewrite/helper.go +++ b/pkg/translator/prometheusremotewrite/helper.go @@ -44,9 +44,10 @@ const ( var exportCreatedMetricGate = featuregate.GlobalRegistry().MustRegister( "exporter.prometheusremotewriteexporter.deprecateCreatedMetric", - featuregate.StageBeta, + featuregate.StageStable, featuregate.WithRegisterDescription("Feature gate used to control the deprecation of created metrics."), featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35003"), + featuregate.WithRegisterToVersion("v0.118.0"), ) type bucketBoundsData struct { diff --git a/pkg/translator/prometheusremotewrite/helper_test.go b/pkg/translator/prometheusremotewrite/helper_test.go index c27c1fde2b31..5e0361ec9db1 100644 --- a/pkg/translator/prometheusremotewrite/helper_test.go +++ b/pkg/translator/prometheusremotewrite/helper_test.go @@ -697,14 +697,12 @@ func TestMostRecentTimestampInMetric(t *testing.T) { func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) { ts := pcommon.Timestamp(time.Now().UnixNano()) tests := []struct { - name string - isGateEnabled bool - metric func() pmetric.Metric - want func() map[uint64]*prompb.TimeSeries + name string + metric func() pmetric.Metric + want func() map[uint64]*prompb.TimeSeries }{ { - name: "summary with start time", - isGateEnabled: false, + name: "summary with start time", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_summary") @@ -720,9 +718,6 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_summary" + countStr}, } - createdLabels := []prompb.Label{ - {Name: model.MetricNameLabel, Value: "test_summary" + createdSuffix}, - } sumLabels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_summary" + sumStr}, } @@ -739,18 +734,11 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) { {Value: 0, Timestamp: convertTimeStamp(ts)}, }, }, - timeSeriesSignature(createdLabels): { - Labels: createdLabels, - Samples: []prompb.Sample{ - {Value: float64(convertTimeStamp(ts)), Timestamp: convertTimeStamp(ts)}, - }, - }, } }, }, { - name: "summary without start time", - isGateEnabled: false, + name: "summary without start time", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_summary") @@ -785,8 +773,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) { }, }, { - name: "summary with exportCreatedMetricGate enabled", - isGateEnabled: true, + name: "summary with exportCreatedMetricGate enabled", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_summary") @@ -825,7 +812,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { oldValue := exportCreatedMetricGate.IsEnabled() - testutil.SetFeatureGateForTest(t, exportCreatedMetricGate, tt.isGateEnabled) + testutil.SetFeatureGateForTest(t, exportCreatedMetricGate, true) defer testutil.SetFeatureGateForTest(t, exportCreatedMetricGate, oldValue) metric := tt.metric() @@ -849,14 +836,12 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) { func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) { ts := pcommon.Timestamp(time.Now().UnixNano()) tests := []struct { - name string - isGateEnabled bool - metric func() pmetric.Metric - want func() map[uint64]*prompb.TimeSeries + name string + metric func() pmetric.Metric + want func() map[uint64]*prompb.TimeSeries }{ { - name: "histogram with start time", - isGateEnabled: false, + name: "histogram with start time", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_hist") @@ -872,9 +857,6 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) { labels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_hist" + countStr}, } - createdLabels := []prompb.Label{ - {Name: model.MetricNameLabel, Value: "test_hist" + createdSuffix}, - } infLabels := []prompb.Label{ {Name: model.MetricNameLabel, Value: "test_hist_bucket"}, {Name: model.BucketLabel, Value: "+Inf"}, @@ -892,18 +874,11 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) { {Value: 0, Timestamp: convertTimeStamp(ts)}, }, }, - timeSeriesSignature(createdLabels): { - Labels: createdLabels, - Samples: []prompb.Sample{ - {Value: float64(convertTimeStamp(ts)), Timestamp: convertTimeStamp(ts)}, - }, - }, } }, }, { - name: "histogram without start time", - isGateEnabled: false, + name: "histogram without start time", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_hist") @@ -939,8 +914,7 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) { }, }, { - name: "histogram with exportCreatedMetricGate enabled", - isGateEnabled: true, + name: "histogram with exportCreatedMetricGate enabled", metric: func() pmetric.Metric { metric := pmetric.NewMetric() metric.SetName("test_hist") @@ -980,7 +954,7 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { oldValue := exportCreatedMetricGate.IsEnabled() - testutil.SetFeatureGateForTest(t, exportCreatedMetricGate, tt.isGateEnabled) + testutil.SetFeatureGateForTest(t, exportCreatedMetricGate, true) defer testutil.SetFeatureGateForTest(t, exportCreatedMetricGate, oldValue) metric := tt.metric()