Skip to content

Implement federated Status API#8484

Merged
saswatamcode merged 6 commits into
thanos-io:mainfrom
simonpasquier:poc-status-grpc-api
Oct 7, 2025
Merged

Implement federated Status API#8484
saswatamcode merged 6 commits into
thanos-io:mainfrom
simonpasquier:poc-status-grpc-api

Conversation

@simonpasquier

@simonpasquier simonpasquier commented Sep 10, 2025

Copy link
Copy Markdown
Contributor
  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

This is a first draft towards an implementation of a federated TSDB Status API. The goal is to kick-off the discussion.

The change covers:

  • New /api/v1/status/tsdb endpoint in Thanos Query (compatible with the existing Prometheus API).
  • Definition of a new gRPC Status API.
  • Implementation of the gRPC Status server for Query and Receive.

Relates to #5395

Verification

Manual verification + unit tests + end-to-end tests.

Comment thread pkg/api/query/v1.go Fixed
@simonpasquier
simonpasquier force-pushed the poc-status-grpc-api branch 3 times, most recently from 2eb699d to c15f7bc Compare September 11, 2025 14:36

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

Thanks for working on this! I think this is in a great direction already!

Would be great to see some e2e test

Comment thread cmd/thanos/query.go Outdated
enableExemplarPartialResponse := cmd.Flag("exemplar.partial-response", "Enable partial response for exemplar endpoint. --no-exemplar.partial-response for disabling.").
Hidden().Default("true").Bool()

enableStatusPartialResponse := cmd.Flag("status.partial-response", "Enable partial response for status endpoint. --no-exemplar.partial-response for disabling.").

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.

Suggested change
enableStatusPartialResponse := cmd.Flag("status.partial-response", "Enable partial response for status endpoint. --no-exemplar.partial-response for disabling.").
enableStatusPartialResponse := cmd.Flag("status.partial-response", "Enable partial response for status endpoint. --no-status.partial-response for disabling.").

Comment thread pkg/api/query/v1.go
This is the initial implementation of a federated TSDB Status API.

Right now, the change covers:
* New `/api/v1/status/tsdb` endpoint in Thanos Query (compatible with
  the existing Prometheus API).
* Definition of a new gRPC Status API.
* Implementation of the gRPC Status server for Query and Receive.

Relates to thanos-io#5395

Signed-off-by: Simon Pasquier <[email protected]>
Signed-off-by: Simon Pasquier <[email protected]>
@simonpasquier
simonpasquier force-pushed the poc-status-grpc-api branch 4 times, most recently from 3ffabb5 to afb0e0a Compare September 25, 2025 15:39
The new tests check the TSDB status API without and with tenancy.

Signed-off-by: Simon Pasquier <[email protected]>
@simonpasquier

Copy link
Copy Markdown
Contributor Author

End-to-end tests added. I think that the failures are unrelated to my change.

@simonpasquier simonpasquier mentioned this pull request Sep 29, 2025
2 tasks
@simonpasquier simonpasquier changed the title [POC] Implement federated Status API Implement federated Status API Sep 29, 2025
Signed-off-by: Simon Pasquier <[email protected]>
@simonpasquier
simonpasquier marked this pull request as ready for review September 29, 2025 07:47

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

Thanks a lot for the effort on this! 💪🏻

LGTM already, just one small comment!

Comment thread pkg/api/query/v1.go
}

// Merge statistics from all tenants.
aggregatedStats := &statuspb.TSDBStatisticsEntry{}

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.

So I thought about this a bit more.

Right now, by default, we get the aggregate stats merged from all TSDBs in multitsdb. And we can pass in a tenant to get specific tenant stats.

But there's also some utility in getting the map of tenants and tenant stats directly (powering a thanos tenant health dashboard)!

Maybe it might be useful to have another bool URL query param here called aggregate?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree that it would useful. But I'm not sure if it should be the same endpoint or if we need a dedicated one (given that the response data will look quite different).

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.

Hmm good point, wouldn't be great. So in that case, maybe some separate thanos specific endpoint.
Happy to have it in a separate PR, rest looks good!

@saswatamcode saswatamcode 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! Let's merge and iterate

Failing test is unrelated

@saswatamcode
saswatamcode merged commit be442a5 into thanos-io:main Oct 7, 2025
20 of 22 checks passed
@simonpasquier
simonpasquier deleted the poc-status-grpc-api branch October 7, 2025 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants