Skip to content

[surfacers.prometheus] Consider either deleting stale gauge metrics by default or always include timestamp for them #1162

Closed

Description

@manugarg

We recently made some changes to prometheus surfacer which encourage timestamp-less exporting, the reason being:

a) if you include timestamp, you'll have to make sure you don't export metrics with timestamps older than 10m, that causes warnings in prometheus metrics scraper. Also this behavior is not right for cumulative metrics if they update infrequently -- prometheus will show gap in data, and sometimes even expire the timeseries if gap is too large.

b) if you don't include timestamps, stale metrics warning goes away, but prometheus continues to consider the scraped value as the current value.

Note that the latter behavior (no timestamp) is fine for cumulative metrics, as it's easy to identify that the value has not changed. But for gauge metrics it's problematic -- they are true at a particular time, not 15 min later for example.

We should make this behavior explicit in configuration. Maybe gauge metrics should always carry timestamps and their stale values should always be deleted, regardless of the config.

Activity

  1. added
    enhancement
    on Oct 23, 2025
  2. self-assigned this
    on Oct 23, 2025
  3. manugarg commented on Oct 23, 2025

    @manugarg
    ContributorAuthor

    My proposal will be to change the default behavior of include_timestamp based on type of metrics -- for cumulative metrics timestamp will not be included and for gauge it will be included.

    // Whether to include timestamps in metrics. If enabled (default) each metric

  4. manugarg commented on Nov 3, 2025

    @manugarg
    ContributorAuthor

    #1169 should do it.

  5. added this to the v0.14.2 milestone on Nov 3, 2025
  6. manugarg commented on Nov 4, 2025

    @manugarg
    ContributorAuthor

    #1169 should fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions