-
Notifications
You must be signed in to change notification settings - Fork 50
Metrics: Add specs on Gauge APIs #248
base: master
Are you sure you want to change the base?
Conversation
e4b773d
to
be2cd5e
Compare
metrics/Gauge.md
Outdated
|
||
## Derived Gauge API | ||
|
||
The value that is published for gauges is an instantaneous measurement of an `int64` or `double` value. This gauge is self sufficient once created, so users should never need to interact with it. The value of the gauge is observed from the `object` and a `callback function`. The callback function is invoked whenever metrics are collected, meaning the reported value is up-to-date. The implementation should keep a `WeakReference` to the object and it is the user's responsibility to manage the lifetime of the object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should explain behavior of a derived gauge in case when object was garbage collected since it's talking about WeakReference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the language (in this case Java) specific details, removed from the specs.
@bogdandrutu @SergeyKanzhelev PTAL once you have time. |
|
||
The following general operations MUST be provided by the API: | ||
* Defining a `name`, `description`, `unit`, `labelKeys`, `resource` and `constantLabels` which are fixed labels that always apply to a gauge. This should give back the gauge object to get or create time series, remove time series and clear all time series. | ||
* `name`: a string describing the name of the metric, e.g. "vm_cpu_cycles" or "queue_size". Names MUST be unique within the library. It is recommended to use names compatible with the intended end usage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any restriction on the formatting of a name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK there is no restriction on the length and it may contain any Unicode characters.
Fixes #240