-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[exporter/prometheusremotewrite] deprecate export_created_metric #36214
base: main
Are you sure you want to change the base?
[exporter/prometheusremotewrite] deprecate export_created_metric #36214
Conversation
846159b
to
2d62181
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @pokgak!
Not sure if this is documented well, but when deprecating we can put the functionality behind a feature gate that is enabled by default. One example of feature gate can be seen here. In the example though the stability is StageAlpha
(disabled by default) and we want it to considered StageBeta
so it's enabled by default.
In version 0.114.0 we'll finally change it to Alpha and in 0.115.0 finally remove the option.
Co-authored-by: Arthur Silva Sens <[email protected]>
@ArthurSens correct me if I'm wrong but isn't the feature already disabled by default so we should be using opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter/config.go Lines 105 to 109 in 7ba5aa3
I pushed a commit using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ArthurSens correct me if I'm wrong but isn't the feature already disabled by default so we should be using
StageAlpha
instead?opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter/config.go
Lines 105 to 109 in 7ba5aa3
if cfg.CreatedMetric == nil { cfg.CreatedMetric = &CreatedMetric{ Enabled: false, } } I pushed a commit using
StageBeta
but note that this will change the default value of theexport_created_metric.enabled
totrue
.
Yes you're correct, I believe I wasn't clear with my previous comment, let me re-phrase it.
What we want to do is add yet another check when we're generating the created metric.
opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite/helper.go
Lines 277 to 280 in 3458d51
if settings.ExportCreatedMetric && startTimestamp != 0 { | |
labels := createLabels(baseName+createdSuffix, baseLabels) | |
c.addTimeSeriesIfNeeded(labels, startTimestamp, pt.Timestamp()) | |
} |
Here we'd switch to:
if settings.ExportCreatedMetric && startTimestamp != 0 && exportCreatedMetricGate.IsEnabled() {
labels := createLabels(baseName+createdSuffix, baseLabels)
c.addTimeSeriesIfNeeded(labels, startTimestamp, pt.Timestamp())
}
And then we'll have to update one test to make sure the feature-gate works as expected:
Add a new boolean to the test case struct, and in the the Run you can add:
oldValue := exportCreatedMetricGate.IsEnabled()
testutil.SetFeatureGateForTest(t, exportCreatedMetricGate, tt.isGateEnabled)
defer testutil.SetFeatureGateForTest(t, exportCreatedMetricGate, oldValue)
@@ -104,7 +114,7 @@ func (cfg *Config) Validate() error { | |||
} | |||
if cfg.CreatedMetric == nil { | |||
cfg.CreatedMetric = &CreatedMetric{ | |||
Enabled: false, | |||
Enabled: exportCreatedMetricGate.IsEnabled(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enabled: exportCreatedMetricGate.IsEnabled(), | |
Enabled: false, |
Let's go back to false!
"exporter.prometheusremotewriteexporter.exportCreatedMetric", | ||
featuregate.StageBeta, | ||
featuregate.WithRegisterDescription("Set the default value of the export_created_metric feature."), | ||
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35003"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"exporter.prometheusremotewriteexporter.exportCreatedMetric", | |
featuregate.StageBeta, | |
featuregate.WithRegisterDescription("Set the default value of the export_created_metric feature."), | |
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35003"), | |
"exporter.prometheusremotewriteexporter.deprecateCreatedMetric", | |
featuregate.StageBeta, | |
featuregate.WithRegisterDescription("Feature gate used to control the deprecation of created metrics."), | |
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35003"), |
Description
Deprecate export_created_metric config option
Link to tracking issue
Fixes #35003