Skip to content

Allow UpDown counters to be 'set' #2054

@RichardWright

Description

@RichardWright

Current spec for UpDownCounters

.inc(5)
.inc(-5)

If the state is based on, for example, the length of an array (eg a list of connected clients), this requires the previous state to be stored somewhere so that subtraction can happen. 

Proposal:

.set(25)

Allow the instrument to be set, this can be then used to map to properties of data structures which inform this and remove the need for diffing. This is possible with an observer but using this required substantial changes to our app and exposing state where we don’t want to. With a synchronous set method, this can be done within methods without exposing internal state to observers. 

The Nodejs package ‘prom-client’ has this functionality already and we find it very useful. 

Metadata

Metadata

Assignees

Labels

release:after-gaNot required before GA release, and not going to work on before GAspec:metricsRelated to the specification/metrics directory

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions