You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A given metric is only meant to be registered once, this issue is to decide how to handle duplicate or already registered metric (Currently not permitted and cause an error with Prometheus).
Possible Solutions:
Option 1: Replace the old registered metric by the new: This seems to be problematic, especially when you use the same name but different type or unit. This might create a problem in backend.
Option 2: Throw an error: This is not really advocated by the specs.
Option 3: Log a warning and skip duplicate metric: This might confuse the end users.
Suggest other options?
The text was updated successfully, but these errors were encountered:
* feat(metrics): add registerMetric and getMetric functionality
* fix: getTimeSeries and add more tests
* fix: minor
* fix: add JSDoc
* fix: minor
* fix: remove
* fix: replace String -> string
* fix: avoid casting
* fix: use GAUGE_DOUBLE and COUNTER_DOUBLE type
* fix: add ValueType to indicate type of the metric
* fix: move ValueType.DOUBLE to DEFAULT_METRIC_OPTIONS
* fix: use Number.isInteger
* fix: log an error instead of throw error
* fix: add more test and @todo comment
* fix: link #474 isssue
It is my opinion that Option 3 is the only currently viable option as option 1 may create problems with different backends (maybe this is handled by individual exporters?) and option 2 is not compatible with current spec (incorrect usage should not throw).
Option 3 may be confusing at first (generally I would expect it to behave like other Set-like APIs which overwrite rather than ignore if you try to set the same thing twice), but it is an easy to understand difference if documented properly.
Summary:
A given
metric
is only meant to be registered once, this issue is to decide how to handle duplicate or already registeredmetric
(Currently not permitted and cause an error with Prometheus).Possible Solutions:
Option 1: Replace the old registered metric by the new: This seems to be problematic, especially when you use the same
name
but differenttype
orunit
. This might create a problem in backend.Option 2: Throw an error: This is not really advocated by the specs.
Option 3: Log a warning and skip duplicate metric: This might confuse the end users.
Suggest other options?
The text was updated successfully, but these errors were encountered: