Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Metrics: Add specs on Gauge APIs #248

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

mayurkale22
Copy link
Member

Fixes #240

metrics/Gauge.md Outdated Show resolved Hide resolved
metrics/Gauge.md Outdated Show resolved Hide resolved
metrics/Gauge.md Outdated Show resolved Hide resolved
metrics/Gauge.md Outdated Show resolved Hide resolved
metrics/Gauge.md Outdated Show resolved Hide resolved
metrics/Gauge.md Outdated Show resolved Hide resolved
metrics/Gauge.md Outdated Show resolved Hide resolved
metrics/Gauge.md Outdated Show resolved Hide resolved
@mayurkale22 mayurkale22 force-pushed the gauges_api branch 2 times, most recently from e4b773d to be2cd5e Compare March 15, 2019 19:41
metrics/Gauge.md Outdated Show resolved Hide resolved
metrics/Gauge.md Outdated Show resolved Hide resolved
metrics/Gauge.md Outdated Show resolved Hide resolved
metrics/Gauge.md Outdated Show resolved Hide resolved
metrics/Gauge.md Outdated Show resolved Hide resolved
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.
Copy link
Member

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.

Copy link
Member Author

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.

@mayurkale22
Copy link
Member Author

@bogdandrutu @SergeyKanzhelev PTAL once you have time.

metrics/Gauge.md Show resolved Hide resolved

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.

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?

Copy link
Member Author

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.

metrics/Gauge.md Outdated Show resolved Hide resolved
metrics/Gauge.md Show resolved Hide resolved
metrics/Gauge.md Outdated Show resolved Hide resolved
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants