Skip to content

Commit 1e13ec0

Browse files
perebajzeck-ops
authored andcommitted
[exporter/prometheusremotewrite] change feature gate to stable (open-telemetry#37399)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description * Change `exporter.prometheusremotewriteexporter.deprecateCreatedMetric`feature gate from Beta to Stable * Adapt some test cases that were considering this feature as disable <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue open-telemetry#35003
1 parent ccd969d commit 1e13ec0

File tree

3 files changed

+43
-41
lines changed

3 files changed

+43
-41
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: exporter/prometheusremotewrite
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Change `exporter.prometheusremotewriteexporter.deprecateCreatedMetric` feature gate from Beta to Stable version.
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [35003]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext: The `export_created_metric` configuration parameter is now permanently deprecated.
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [user]

pkg/translator/prometheusremotewrite/helper.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ const (
4444

4545
var exportCreatedMetricGate = featuregate.GlobalRegistry().MustRegister(
4646
"exporter.prometheusremotewriteexporter.deprecateCreatedMetric",
47-
featuregate.StageBeta,
47+
featuregate.StageStable,
4848
featuregate.WithRegisterDescription("Feature gate used to control the deprecation of created metrics."),
4949
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35003"),
50+
featuregate.WithRegisterToVersion("v0.118.0"),
5051
)
5152

5253
type bucketBoundsData struct {

pkg/translator/prometheusremotewrite/helper_test.go

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -697,14 +697,12 @@ func TestMostRecentTimestampInMetric(t *testing.T) {
697697
func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) {
698698
ts := pcommon.Timestamp(time.Now().UnixNano())
699699
tests := []struct {
700-
name string
701-
isGateEnabled bool
702-
metric func() pmetric.Metric
703-
want func() map[uint64]*prompb.TimeSeries
700+
name string
701+
metric func() pmetric.Metric
702+
want func() map[uint64]*prompb.TimeSeries
704703
}{
705704
{
706-
name: "summary with start time",
707-
isGateEnabled: false,
705+
name: "summary with start time",
708706
metric: func() pmetric.Metric {
709707
metric := pmetric.NewMetric()
710708
metric.SetName("test_summary")
@@ -720,9 +718,6 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) {
720718
labels := []prompb.Label{
721719
{Name: model.MetricNameLabel, Value: "test_summary" + countStr},
722720
}
723-
createdLabels := []prompb.Label{
724-
{Name: model.MetricNameLabel, Value: "test_summary" + createdSuffix},
725-
}
726721
sumLabels := []prompb.Label{
727722
{Name: model.MetricNameLabel, Value: "test_summary" + sumStr},
728723
}
@@ -739,18 +734,11 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) {
739734
{Value: 0, Timestamp: convertTimeStamp(ts)},
740735
},
741736
},
742-
timeSeriesSignature(createdLabels): {
743-
Labels: createdLabels,
744-
Samples: []prompb.Sample{
745-
{Value: float64(convertTimeStamp(ts)), Timestamp: convertTimeStamp(ts)},
746-
},
747-
},
748737
}
749738
},
750739
},
751740
{
752-
name: "summary without start time",
753-
isGateEnabled: false,
741+
name: "summary without start time",
754742
metric: func() pmetric.Metric {
755743
metric := pmetric.NewMetric()
756744
metric.SetName("test_summary")
@@ -785,8 +773,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) {
785773
},
786774
},
787775
{
788-
name: "summary with exportCreatedMetricGate enabled",
789-
isGateEnabled: true,
776+
name: "summary with exportCreatedMetricGate enabled",
790777
metric: func() pmetric.Metric {
791778
metric := pmetric.NewMetric()
792779
metric.SetName("test_summary")
@@ -825,7 +812,7 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) {
825812
for _, tt := range tests {
826813
t.Run(tt.name, func(t *testing.T) {
827814
oldValue := exportCreatedMetricGate.IsEnabled()
828-
testutil.SetFeatureGateForTest(t, exportCreatedMetricGate, tt.isGateEnabled)
815+
testutil.SetFeatureGateForTest(t, exportCreatedMetricGate, true)
829816
defer testutil.SetFeatureGateForTest(t, exportCreatedMetricGate, oldValue)
830817

831818
metric := tt.metric()
@@ -849,14 +836,12 @@ func TestPrometheusConverter_AddSummaryDataPoints(t *testing.T) {
849836
func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) {
850837
ts := pcommon.Timestamp(time.Now().UnixNano())
851838
tests := []struct {
852-
name string
853-
isGateEnabled bool
854-
metric func() pmetric.Metric
855-
want func() map[uint64]*prompb.TimeSeries
839+
name string
840+
metric func() pmetric.Metric
841+
want func() map[uint64]*prompb.TimeSeries
856842
}{
857843
{
858-
name: "histogram with start time",
859-
isGateEnabled: false,
844+
name: "histogram with start time",
860845
metric: func() pmetric.Metric {
861846
metric := pmetric.NewMetric()
862847
metric.SetName("test_hist")
@@ -872,9 +857,6 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) {
872857
labels := []prompb.Label{
873858
{Name: model.MetricNameLabel, Value: "test_hist" + countStr},
874859
}
875-
createdLabels := []prompb.Label{
876-
{Name: model.MetricNameLabel, Value: "test_hist" + createdSuffix},
877-
}
878860
infLabels := []prompb.Label{
879861
{Name: model.MetricNameLabel, Value: "test_hist_bucket"},
880862
{Name: model.BucketLabel, Value: "+Inf"},
@@ -892,18 +874,11 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) {
892874
{Value: 0, Timestamp: convertTimeStamp(ts)},
893875
},
894876
},
895-
timeSeriesSignature(createdLabels): {
896-
Labels: createdLabels,
897-
Samples: []prompb.Sample{
898-
{Value: float64(convertTimeStamp(ts)), Timestamp: convertTimeStamp(ts)},
899-
},
900-
},
901877
}
902878
},
903879
},
904880
{
905-
name: "histogram without start time",
906-
isGateEnabled: false,
881+
name: "histogram without start time",
907882
metric: func() pmetric.Metric {
908883
metric := pmetric.NewMetric()
909884
metric.SetName("test_hist")
@@ -939,8 +914,7 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) {
939914
},
940915
},
941916
{
942-
name: "histogram with exportCreatedMetricGate enabled",
943-
isGateEnabled: true,
917+
name: "histogram with exportCreatedMetricGate enabled",
944918
metric: func() pmetric.Metric {
945919
metric := pmetric.NewMetric()
946920
metric.SetName("test_hist")
@@ -980,7 +954,7 @@ func TestPrometheusConverter_AddHistogramDataPoints(t *testing.T) {
980954
for _, tt := range tests {
981955
t.Run(tt.name, func(t *testing.T) {
982956
oldValue := exportCreatedMetricGate.IsEnabled()
983-
testutil.SetFeatureGateForTest(t, exportCreatedMetricGate, tt.isGateEnabled)
957+
testutil.SetFeatureGateForTest(t, exportCreatedMetricGate, true)
984958
defer testutil.SetFeatureGateForTest(t, exportCreatedMetricGate, oldValue)
985959

986960
metric := tt.metric()

0 commit comments

Comments
 (0)