Skip to content

Allow partial data in tenant-federation#7232

Open
SungJin1212 wants to merge 5 commits intocortexproject:masterfrom
SungJin1212:Allow-partial-data-in-federation
Open

Allow partial data in tenant-federation#7232
SungJin1212 wants to merge 5 commits intocortexproject:masterfrom
SungJin1212:Allow-partial-data-in-federation

Conversation

@SungJin1212
Copy link
Member

@SungJin1212 SungJin1212 commented Jan 27, 2026

This PR introduces experimental flag -tenant-federation.allow-partial-data for partial responses when using Tenant Federation.

Currently, when querying multiple tenants via federation, a failure in a single tenant causes the entire query to fail. With this change, users can opt-in to a mode where errors from individual tenants are treated as warnings, allowing partial results from successful tenants to be returned.

This is particularly useful when using the regex resolver (e.g., X-Scope-OrgID: user-.*). When dynamically matching a large number of tenants, a single failing tenant will no longer block the entire query result.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@SungJin1212 SungJin1212 changed the title Allow partial data in federation Allow partial data in tenant-federation Jan 27, 2026
@SungJin1212 SungJin1212 force-pushed the Allow-partial-data-in-federation branch from 67997cb to cf71562 Compare February 16, 2026 04:43
res, err := job.querier.Select(start, end, allUnrelatedMatchers...)
if err != nil {
if m.allowPartialData {
return nil
Copy link
Member

Choose a reason for hiding this comment

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

do we need a warning here?

if err != nil {
return errors.Wrapf(err, "error exemplars querying %s %s", job.id, err)
if m.allowPartialData {
return nil
Copy link
Member

Choose a reason for hiding this comment

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

do we need to add a warning ?

@SungJin1212
Copy link
Member Author

@friedrichg

type MetadataQuerier interface {
	MetricsMetadata(ctx context.Context, req *client.MetricsMetadataRequest) ([]scrape.MetricMetadata, error)
}

// ExemplarQuerier provides reading access to time series data.
type ExemplarQuerier interface {
	// Select all the exemplars that match the matchers.
	// Within a single slice of matchers, it is an intersection. Between the slices, it is a union.
	Select(start, end int64, matchers ...[]*labels.Matcher) ([]exemplar.QueryResult, error)
}

I'd love to add a warning here, but the upstream interface doesn't support returning warnings like SeriesSet does. Do we need to log an error at the Warn level?

@friedrichg
Copy link
Member

Looking at #6526 I see partial data for metadata was not implemented because prometheus does not support it. Maybe we should do the same here?

Same for exemplars.

@SungJin1212 How does grafana or perses react with errors in these APIs? maybe it just ignores it

@SungJin1212
Copy link
Member Author

SungJin1212 commented Feb 18, 2026

@friedrichg
Since we suppress the error, Grafana simply won't receive data for the failed tenants and will display the partial results without any warning.

Yeah, the Prometheus interface doesn't support returning warnings. Should we disable partial data for exemplars and metadata?

Copy link
Member

@friedrichg friedrichg left a comment

Choose a reason for hiding this comment

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

Ignoring the error is bad at least send a warning to the logs. I feel.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 18, 2026
@SungJin1212 SungJin1212 force-pushed the Allow-partial-data-in-federation branch from cf71562 to bac8e6a Compare February 18, 2026 06:22
Signed-off-by: SungJin1212 <tjdwls1201@gmail.com>
Signed-off-by: SungJin1212 <tjdwls1201@gmail.com>
Signed-off-by: SungJin1212 <tjdwls1201@gmail.com>
Signed-off-by: SungJin1212 <tjdwls1201@gmail.com>
Signed-off-by: SungJin1212 <tjdwls1201@gmail.com>
@SungJin1212 SungJin1212 force-pushed the Allow-partial-data-in-federation branch from bac8e6a to 927d8a2 Compare February 19, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/querier lgtm This PR has been approved by a maintainer size/L type/feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments