-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat: promote feature flag removeStartTimeAdjustment to stable #44851
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
base: main
Are you sure you want to change the base?
feat: promote feature flag removeStartTimeAdjustment to stable #44851
Conversation
Signed-off-by: perebaj <perebaj@gmail.com>
Signed-off-by: perebaj <perebaj@gmail.com>
Signed-off-by: perebaj <perebaj@gmail.com>
Signed-off-by: perebaj <perebaj@gmail.com>
Signed-off-by: perebaj <perebaj@gmail.com>
| // TestStartTimeMetric validates that timeseries have start time set to 'process_start_time_seconds' | ||
| func TestStartTimeMetric(t *testing.T) { | ||
| err := featuregate.GlobalRegistry().Set("receiver.prometheusreceiver.RemoveStartTimeAdjustment", false) | ||
| require.NoError(t, err) | ||
| defer func() { | ||
| _ = featuregate.GlobalRegistry().Set("receiver.prometheusreceiver.RemoveStartTimeAdjustment", true) | ||
| }() | ||
| targets := []*testData{ | ||
| { | ||
| name: "target1", | ||
| pages: []mockPrometheusResponse{ | ||
| {code: 200, data: startTimeMetricPage}, | ||
| }, | ||
| validateFunc: verifyStartTimeMetricPage, | ||
| }, | ||
| } | ||
| testComponent(t, targets, func(c *Config) { | ||
| c.UseStartTimeMetric = true | ||
| }) | ||
| } | ||
|
|
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.
Is that test makes sense for the current statement? I don't think so...
This function expects the receiver to adjust the StartTimestamp from process_start_time_seconds
After receiver.prometheusreceiver.RemoveStartTimeAdjustment was promoted to stable, the transaction production flow does:
if !removeStartTimeAdjustment.IsEnabled() {
// only here would it call the adjuster (including the StartTimeMetricAdjuster)
t.metricAdjuster.AdjustMetrics(md)}Since the gate is stable, it is always enabled and cannot be turned off; then this block never runs and no start time adjustment is made, even with UseStartTimeMetric = true.
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.
yes, you can remove this test.
ArthurSens
left a comment
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.
I was going through the changes and realized I have different expectations for a stable feature gate.
I thought that meant we could delete the codebase related to the metrics adjuster because a stable feature gate will never decrease its stability. I'm wondering if my expectations are correct or if we need to keep that code around for some reason 🤔
| "go.opentelemetry.io/collector/pdata/pmetric" | ||
| semconv "go.opentelemetry.io/otel/semconv/v1.27.0" | ||
| "go.uber.org/zap" | ||
|
|
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.
If we're removing metrics adjuster, should we even keep this file? If I understand it correctly it's only testing starttimeadjuster
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.
| } | ||
| } | ||
|
|
||
| func (stma *startTimeMetricAdjuster) AdjustMetrics(metrics pmetric.Metrics) error { |
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.
Shouldn't we delete this whole codebase?
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.
| func TestTransactionCommitErrorWhenAdjusterError(t *testing.T) { | ||
| for _, enableNativeHistograms := range []bool{true, false} { | ||
| t.Run(fmt.Sprintf("enableNativeHistograms=%v", enableNativeHistograms), func(t *testing.T) { | ||
| defer testutil.SetFeatureGateForTest(t, removeStartTimeAdjustment, false)() | ||
| testTransactionCommitErrorWhenAdjusterError(t, enableNativeHistograms) | ||
| }) | ||
| } |
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.
This tests when the adjuster fails. Shouldn't we delete this test?
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.
Makes sense, thanks!
removed here ->
80d0584
Signed-off-by: perebaj <perebaj@gmail.com>
| useCreatedMetric bool, | ||
| enableNativeHistograms bool, | ||
| useMetadata bool, | ||
| externalLabels labels.Labels, | ||
| trimSuffixes bool, | ||
| ) (storage.Appendable, error) { | ||
| var metricAdjuster MetricsAdjuster | ||
| if !useStartTimeMetric { | ||
| metricAdjuster = NewInitialPointAdjuster(set.Logger, gcInterval, useCreatedMetric) | ||
| } else { | ||
| metricAdjuster = NewStartTimeMetricAdjuster(set.Logger, startTimeMetricRegex, gcInterval) | ||
| } | ||
|
|
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.
Since we don't need of this code anymore, the feature
var useCreatedMetricGate = featuregate.GlobalRegistry().MustRegister can be removed. But I don't know if should I remove it or just omit the var declaration, as I did here
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.
Talking about this change here -> https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/44851/files#r2608462092
|
|
||
| // This file implements config for Prometheus receiver. | ||
| var useCreatedMetricGate = featuregate.GlobalRegistry().MustRegister( | ||
| var _ = featuregate.GlobalRegistry().MustRegister( |
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.
Should we remove this feature gate, or this should be done in a different PR? We are basically deprecating the necessity to use it.
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.
done in a different PR I think. I believe you should use featuregate.WithRegisterToVersion, with a version a few releases in the future.
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.
oh, wait. I didn't realize this isn't a different feature gate. This is unrelated to this PR. Please make the change to the created timestamp gate in a new PR if thats ok.
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.
but is it ok to leave var definition as I did? ⬇️
var _ = featuregate.GlobalRegistry().MustRegister(
With that, I think that we are basically deprecating the variable, because we aren't using it anymore
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.
ah, I see. This is a sub-feature of the metrics adjuster.
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.
Final update, I promise :). You should set this to featuregate.StageDeprecated, and add WithRegisterToVersion, but leave it around.
Please also add to the release notes that this disables the created metric feature gate. However, this does not mean that the _created series is always ignored. Prometheus parses the _created series as the start timestamp, but only when using OpenMetrics 1.0. So this change is removing support for the _created series only from other scrape protocols.
Signed-off-by: perebaj <perebaj@gmail.com>
Signed-off-by: perebaj <perebaj@gmail.com>
|
@ArthurSens the stable gate can't be disabled, so it is OK to remove code: https://github.com/open-telemetry/opentelemetry-collector/blob/main/featuregate/README.md#feature-lifecycle
|
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.
|
isn't better to wait for this PR here? I think that it will add more conflicts 🫠 |
Description
Promote feature flag
removeStartTimeAdjustmentto StableLink to tracking issue
Fixes #44180