Skip to content

feat: Add feature flags for read path #4211

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

Merged
merged 1 commit into from
Jun 18, 2025

Conversation

simonswine
Copy link
Contributor

@simonswine simonswine commented May 29, 2025

This implements #4095

Contrary to the initial plan, it provides a CapabilityService with FeatureFlag API targeting the read path only. It is exposed by QueryFrontends/Queriers.

The state of those feature flags is directly derived from the config and can't be changed during runtime. Those feature flags are exposed via metrics.

Copy link
Collaborator

@kolesnikovae kolesnikovae left a comment

Choose a reason for hiding this comment

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

Thanks for adding this!

I hope we'll get a chance to discuss the API – I'd seriously consider introducing a dedicated service rather than extending existing ones.

Comment on lines 32 to 34

// GetFeatureFlags returns the enabled backend feature flags for the current tenant
rpc GetFeatureFlags(types.v1.GetFeatureFlagsRequest) returns (types.v1.GetFeatureFlagsResponse) {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should have a dedicated service.

It's more convenient for both the client and the server. Otherwise, we would need to add the handler to every service, along with its implementation (so we also need to support this in the client). I've already counted 6 implementations, and we might also need handlers for VCS, ad-hoc, tenant settings, OTLP, and other services we may add later.

The API method feels rather out of place here – the querier service should be responsible for queries only.

As for scope (not sure if we really need it), it could just be a parameter in the request.

Comment on lines 145 to 147
if !flag.Parameters.Enabled {
continue
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure I understand the purpose of the Enabled flag. If we filter out disabled features, we probably don't need the Enabled attribute (at least at the API level)

@simonswine simonswine force-pushed the 20250529_add-feature-flags branch from f322d28 to 9f45d97 Compare June 9, 2025 14:21
@simonswine simonswine force-pushed the 20250529_add-feature-flags branch from 9f45d97 to 9e62963 Compare June 18, 2025 10:30
@simonswine simonswine force-pushed the 20250529_add-feature-flags branch from 9e62963 to 5aaa906 Compare June 18, 2025 13:00
@simonswine simonswine changed the title WIP feature flags feat: Add feature flags for read path Jun 18, 2025
@simonswine simonswine marked this pull request as ready for review June 18, 2025 13:24
@simonswine simonswine requested review from marcsanmi, aleks-p and a team as code owners June 18, 2025 13:24
@simonswine simonswine enabled auto-merge (squash) June 18, 2025 13:28
Copy link
Contributor

@aleks-p aleks-p left a comment

Choose a reason for hiding this comment

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

LGTM

@simonswine simonswine merged commit b95d12f into grafana:main Jun 18, 2025
24 checks passed
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.

3 participants