Skip to content

Counter initialization #260

@DifferentialOrange

Description

@DifferentialOrange

It is implied that counter start from 0, since counter value after its first inc(1) will be 1.

But metric value do not exist until first inc() call (since there are no other methods to change counter metric value). So if value if never changed, metric will be null.

For example, it is a common case to count process errors with counter. But if we did not have any errors from the start, the metric will be null. HTTP activity is the same (#96): it is more convenient to know that we had 0 requests on some route rather then no data. No data if often treated like "there is something wrong with metric retrieval" rather then "it's a plain zero".

It is now possible to initialize counter with specific labels with

counter:inc(0, label_pairs)

but it is definitely a duct tape. It would be better to support this behavior explicitly, e.g. with some collector method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions