-
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.
@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)
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.
LGTM, thank you!
Could a maintainer take a look and trigger CI?
Actually, @pokgak could you rebase your PR on top of main? It looks like you've got some merge conflicts |
@ArthurSens thanks for the detailed steps. In case you're reviewing this already, I only followed based on your steps for now. I think I need to also add test case for when the feature gate is false to make sure it's working correctly but haven't had time yet will do it tomorrow. |
That makes perfect sense, I'm glad you brought it up! |
Co-authored-by: Arthur Silva Sens <[email protected]>
Co-authored-by: Arthur Silva Sens <[email protected]>
964ef73
to
f11490c
Compare
@ArthurSens I added the test case and rebased to main. Also updated another test TestPrometheusConverter_AddSummaryDataPoints since it uses the exportCreatedMetric config option too. Should be ready for review again. |
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.
Thanks!
Co-authored-by: David Ashpole <[email protected]>
@dashpole i changed the default feature gate stage to alpha and updated the code and tests accordingly. |
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 again!
…cate-created-metric
Description
Deprecate export_created_metric config option
Link to tracking issue
Fixes #35003