Skip to content

increase() should consider creation of new timeseries as reset #1673

@discordianfish

Description

@discordianfish

Right now if a time series didn't exist and comes into existence with value 1, increase() returns 0 since Prometheus doesn't know if the counter actually was increased or simply scraped for the first time.
Where this is technically right, there are use cases where you can't set a timeseries to 0 before the counter gets increased the first time. Think of any kind of low frequency event tracking where you can't expose that a even didn't happen (set to 0) before you saw the event the first time.

Alternatively to changing increase(), we could also add a function to prefix a timeseries with a 0 value. Something that would take a scalar and range vector and return the range vector with the scalar prefix if it has no value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions