Skip to content

Add cortex_ingester_tsdb_head_max_timestamp metric#7694

Open
yeya24 wants to merge 1 commit into
cortexproject:masterfrom
yeya24:add-ingester-head-max-timestamp-metric
Open

Add cortex_ingester_tsdb_head_max_timestamp metric#7694
yeya24 wants to merge 1 commit into
cortexproject:masterfrom
yeya24:add-ingester-head-max-timestamp-metric

Conversation

@yeya24

@yeya24 yeya24 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What this PR does:

TSDB exposes the max timestamp of the head block via prometheus_tsdb_head_max_time, but the Cortex ingester did not re-export it per tenant. This PR adds a new cortex_ingester_tsdb_head_max_timestamp metric (with a user label) that re-exports the TSDB head max timestamp per user, following the existing re-export pattern in pkg/ingester/metrics.go (aggregated with max across TSDBs via SendMaxOfGaugesPerUser). The value is in milliseconds since epoch, matching the unit Cortex uses for the TSDB head.

This improves debuggability for ingestion issues: for example, when investigating out-of-bounds ("sample too old") write errors, operators can now directly see each tenant's head max time and compare it against incoming sample timestamps.

Which issue(s) this PR fixes:
N/A

Checklist

  • Tests updated
  • Documentation added (not needed — metric-only change, make doc produces no changes)
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]
  • docs/configuration/v1-guarantees.md updated if this PR introduces experimental flags (N/A — no flags introduced)

Re-export the TSDB head max timestamp (prometheus_tsdb_head_max_time)
from the ingester per user. This helps investigate ingestion issues
such as out-of-bounds (sample too old) errors by making the per-tenant
TSDB head max time visible.

Signed-off-by: Ben Ye <benye@amazon.com>
@dosubot dosubot Bot added component/ingester type/observability To help know what is going on inside Cortex labels Jul 17, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/ingester lgtm This PR has been approved by a maintainer size/S type/observability To help know what is going on inside Cortex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants