Skip to content

Add configuration option to control extra-scrape-metrics - #17606

Merged
ArthurSens merged 6 commits into
mainfrom
extra-scrape-metrics
Jan 6, 2026
Merged

ArthurSens merged 6 commits into
mainfrom
extra-scrape-metrics

Conversation

@ArthurSens

@ArthurSens ArthurSens commented Nov 24, 2025 •

Copy link
Copy Markdown
Member

Fixes #17535


As mentioned in the issue, the feature flag has been in place for at least four years, so I propose a new configuration option to stabilize the feature.

Following the example set by native-histograms, my plan here would be:

  • Keep the feature flag until the next major version, while the new configuration option is also available
  • Let users slowly migrate from feature flag to configuration file
  • Finally, remove the feature flag
[FEATURE] Scrape: Move functionality of the `extra-scrape-metrics` feature flag to the configuration file, available as `global.extra_scrape_metrics` and also `scrape_configs.extra_scrape_metrics`. 

@krajorama krajorama self-assigned this Nov 25, 2025
@roidelapluie

Copy link
Copy Markdown
Member

Note that in the doc you say: removed in a future major version, but in the PR you say minor (I'd prefer major).

@ArthurSens

ArthurSens commented Nov 25, 2025 •

Copy link
Copy Markdown
Member Author

Note that in the doc you say: removed in a future major version, but in the PR you say minor (I'd prefer major).

whoops, PR description updated

@krajorama

Copy link
Copy Markdown
Member

This is different from what we did for native histograms where the config file takes precedence #17315 . Meaning that you can override the feature flag by setting the option to "false".

This solution is simpler, but I think we need to make clear in the documentation that if you do set the feature flag, the configuration option isn't effective at all.

@ArthurSens

Copy link
Copy Markdown
Member Author

Weird, I'm not seeing this build errors locally even though I have no diff with this branch 🤔

@ArthurSens

Copy link
Copy Markdown
Member Author

Ah ok, it's an incompatibility with #17427. Found the problem after rebasing the PR. Let me fix that

Comment thread scrape/manager.go Resolved
Comment thread config/config.go Resolved
Comment thread config/config_test.go Resolved
Comment thread scrape/manager.go Resolved
Comment thread scrape/manager.go Resolved

@krajorama krajorama left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

New diff for scrape.go:

diff --git a/scrape/scrape.go b/scrape/scrape.go
index 33683b4ca..70ca8ad42 100644
--- a/scrape/scrape.go
+++ b/scrape/scrape.go
@@ -1212,12 +1212,12 @@ func newScrapeLoop(opts scrapeLoopOptions) *scrapeLoop {
                fallbackScrapeProtocol:        opts.sp.config.ScrapeFallbackProtocol.HeaderMediaType(),
                enableCompression:             opts.sp.config.EnableCompression,
                mrc:                           opts.sp.config.MetricRelabelConfigs,
+               reportExtraMetrics:            opts.sp.config.ExtraScrapeMetricsEnabled(),
                validationScheme:              opts.sp.config.MetricNameValidationScheme,
 
                // scrape.Options.
                enableSTZeroIngestion:   opts.sp.options.EnableStartTimestampZeroIngestion,
                enableTypeAndUnitLabels: opts.sp.options.EnableTypeAndUnitLabels,
-               reportExtraMetrics:      opts.sp.options.ExtraMetrics,
                appendMetadataToWAL:     opts.sp.options.AppendMetadata,
                passMetadataInContext:   opts.sp.options.PassMetadataInContext,
                skipOffsetting:          opts.sp.options.skipOffsetting,

Signed-off-by: Arthur Silva Sens <[email protected]>
Signed-off-by: Arthur Silva Sens <[email protected]>
Signed-off-by: Arthur Silva Sens <[email protected]>
Signed-off-by: Arthur Silva Sens <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stabilize feature flag extra-scrape-metrics

3 participants