thanos-io/thanos · error
TSDB statistics not implemented
Error message
TSDB statistics not implemented
What it means
status.NewServer in pkg/status/status.go:138 initializes the TSDBStatisticsGetter with a stub that always returns 'TSDB statistics not implemented'. Unless the caller supplies WithTSDBStatisticsGetter, any call to the Server's TSDBStatistics gRPC endpoint (pkg/status/status.go:166) immediately fails with this error.
Solutions
- Pass the WithTSDBStatisticsGetter option when constructing the Server, backed by a real tsdb.DB.Stats implementation
- If the component legitimately has no TSDB, stop clients from calling the TSDBStatistics endpoint on it and surface the error to the client as 'not supported'
- Implement a custom TSDBStatisticsGetter that aggregates stats from the correct TSDB instances
- Check component wiring/startup logs to confirm the getter option was applied before serving
Example fix
// before
srv := status.NewServer("query-frontend")
// after
srv := status.NewServer("query-frontend", status.WithTSDBStatisticsGetter(getter)) Defensive patterns
Strategy: validation
Validate before calling
// before serving, assert the getter was configured
if !tsdbGetterConfigured(srv) {
logger.Warn("component does not support TSDB statistics; clients should not call this RPC")
} Try / catch
stats, err := statusClient.TSDBStatistics(ctx, req)
if err != nil && strings.Contains(err.Error(), "TSDB statistics not implemented") {
return nil, fmt.Errorf("component %s does not support TSDB statistics", component)
} Prevention
- Always pass WithTSDBStatisticsGetter when the component owns a TSDB
- Document per-component support for the TSDBStatistics RPC
- Gate client UI/API calls behind a component capability check
- Add a startup-time assertion that the getter is non-stub when required
When it happens
Trigger: Constructing status.NewServer without the WithTSDBStatisticsGetter option, then a client invokes the TSDBStatistics RPC; or a component that intentionally does not support TSDB stats serves the endpoint.
Common situations: Embedding Thanos components (e.g. query frontend, rule evaluator) that have no TSDB and never registered a getter; forgetting to pass the option when wiring components; a client hitting the status endpoint of a component that does not own a TSDB.
Related errors
- no tsdb statistics
- building gRPC client
- not ready
- raw resolution must be higher than the minimum block size…
- 5m resolution retention must be higher than the minimum…
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/c10f5a9cfcc771bd.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/status/status.go:145
TSDBStatistics(limit int, matchers []storepb.LabelMatcher) (map[string]tsdb.Stats, error)
}
type TSDBStatisticsGetterFunc func(int, []storepb.LabelMatcher) (map[string]tsdb.Stats, error)
func (f TSDBStatisticsGetterFunc) TSDBStatistics(limit int, matchers []storepb.LabelMatcher) (map[string]tsdb.Stats, error) {
return f(limit, matchers)
}
// NewServer creates a new server instance for the given component
// and with the specified options.
func NewServer(
component string,
options ...ServerOptionFunc,
) *Server {
srv := &Server{
component: component,
tsdbStatisticsGetter: TSDBStatisticsGetterFunc(func(int, []storepb.LabelMatcher) (map[string]tsdb.Stats, error) {
return nil, errors.New("TSDB statistics not implemented")
}),
}
for _, o := range options {
o(srv)
}
return srv
}
// ServerOptionFunc represents a functional option to configure the status server.
type ServerOptionFunc func(*Server)
func WithTSDBStatisticsGetter(tsg TSDBStatisticsGetter) func(*Server) {
return func(s *Server) {
s.tsdbStatisticsGetter = tsg
}
}View on GitHub (pinned to 35b8b99117)