Skip to content
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

Conversation

pokgak
Copy link
Contributor

@pokgak pokgak commented Nov 5, 2024

Description

Deprecate export_created_metric config option

Link to tracking issue

Fixes #35003

Copy link

linux-foundation-easycla bot commented Nov 5, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@pokgak pokgak force-pushed the exporter/prometheusremotewriteexporter/deprecate-created-metric branch from 846159b to 2d62181 Compare November 5, 2024 15:17
@pokgak pokgak marked this pull request as ready for review November 5, 2024 15:18
@pokgak pokgak requested a review from a team as a code owner November 5, 2024 15:18
Copy link
Member

@ArthurSens ArthurSens left a 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.

.chloggen/35003-deprecate-export_created_metric.yaml Outdated Show resolved Hide resolved
exporter/prometheusremotewriteexporter/config.go Outdated Show resolved Hide resolved
exporter/prometheusremotewriteexporter/README.md Outdated Show resolved Hide resolved
@pokgak
Copy link
Contributor Author

pokgak commented Nov 7, 2024

@ArthurSens correct me if I'm wrong but isn't the feature already disabled by default so we should be using StageAlpha instead?

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 the export_created_metric.enabled to true.

@pokgak pokgak requested a review from ArthurSens November 7, 2024 07:24
Copy link
Member

@ArthurSens ArthurSens left a 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?

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 the export_created_metric.enabled to true.

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.

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)

exporter/prometheusremotewriteexporter/config.go Outdated Show resolved Hide resolved
exporter/prometheusremotewriteexporter/config.go Outdated Show resolved Hide resolved
Copy link
Member

@ArthurSens ArthurSens left a 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?

@ArthurSens
Copy link
Member

Actually, @pokgak could you rebase your PR on top of main? It looks like you've got some merge conflicts

@pokgak
Copy link
Contributor Author

pokgak commented Nov 8, 2024

@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.

@ArthurSens
Copy link
Member

@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!

@pokgak pokgak force-pushed the exporter/prometheusremotewriteexporter/deprecate-created-metric branch from 964ef73 to f11490c Compare November 9, 2024 05:54
@pokgak
Copy link
Contributor Author

pokgak commented Nov 9, 2024

@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.

@pokgak pokgak requested a review from ArthurSens November 9, 2024 06:01
Copy link
Member

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@pokgak pokgak requested a review from dashpole November 13, 2024 17:30
@pokgak
Copy link
Contributor Author

pokgak commented Nov 13, 2024

@dashpole i changed the default feature gate stage to alpha and updated the code and tests accordingly.

Copy link
Member

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank again!

@dashpole dashpole added ready to merge Code review completed; ready to merge by maintainers and removed ready to merge Code review completed; ready to merge by maintainers labels Nov 14, 2024
@TylerHelmuth TylerHelmuth removed the ready to merge Code review completed; ready to merge by maintainers label Nov 18, 2024
@TylerHelmuth
Copy link
Member

@pokgak please handle merge conflicts

@dashpole
Copy link
Contributor

I tried resolving the conflicts manually. Lets see if it works

@TylerHelmuth TylerHelmuth merged commit b97b1b6 into open-telemetry:main Nov 18, 2024
158 checks passed
@github-actions github-actions bot added this to the next release milestone Nov 18, 2024
@pokgak
Copy link
Contributor Author

pokgak commented Nov 19, 2024

thanks @dashpole @TylerHelmuth for the review and merge! also thanks to @ArthurSens for the guidance, if you got any other issues you need help with feel free to ping me.

@pokgak pokgak deleted the exporter/prometheusremotewriteexporter/deprecate-created-metric branch November 19, 2024 05:47
RutvikS-crest pushed a commit to RutvikS-crest/opentelemetry-collector-contrib that referenced this pull request Dec 9, 2024
…n-telemetry#36214)

#### Description

Deprecate export_created_metric config option

#### Link to tracking issue
Fixes open-telemetry#35003

---------

Co-authored-by: Arthur Silva Sens <arthursens2005@gmail.com>
Co-authored-by: David Ashpole <dashpole@google.com>
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
…n-telemetry#36214)

#### Description

Deprecate export_created_metric config option

#### Link to tracking issue
Fixes open-telemetry#35003

---------

Co-authored-by: Arthur Silva Sens <arthursens2005@gmail.com>
Co-authored-by: David Ashpole <dashpole@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[exporter/prometheusremotewriteexporter] Deprecate and Remove export_created_metric feature.
5 participants