Prometheus.Metric.Boolean (Prometheus.ex v5.0.0)
View SourceBoolean metric, to report booleans and flags.
Boolean is a non-standard metric that uses untyped metric underneath.
A Boolean is typically used as a flag i.e. enabled/disabled, online/offline.
Example:
-module(my_fuse_instrumenter).
-export([setup/0,
fuse_event/2]).
setup() ->
prometheus_boolean:declare([{name, app_fuse_state},
{labels, [name]}, %% fuse name
{help, "State of various app fuses."}]),
fuse_event(Fuse, Event) ->
case Event of
ok -> prometheus_boolean:set(app_fuse_state, [Fuse], true);
blown -> prometheus_boolean:set(app_fuse_state, [Fuse], false);
_ -> ok
end.
Summary
Functions
Creates a boolean using spec.
If a boolean with the same spec exists returns false.
Creates a boolean using spec.
Removes boolean series identified by spec.
Resets the value of the boolean identified by spec.
Sets the boolean identified by spec to value.
Toggles the boolean identified by spec to value.
Returns the value of the boolean identified by spec. If there is no boolean for
given labels combination, returns :undefined.
Functions
Creates a boolean using spec.
If a boolean with the same spec exists returns false.
Raises Prometheus.MissingMetricSpecKeyError if required spec key is missing.<br>
Raises Prometheus.InvalidMetricNameError if metric name is invalid.<br>
Raises Prometheus.InvalidMetricHelpError if help is invalid.<br>
Raises Prometheus.InvalidMetricLabelsError if labels isn't a list.<br>
Raises Prometheus.InvalidLabelNameError if label name is invalid.
Creates a boolean using spec.
Raises Prometheus.MissingMetricSpecKeyError if required spec key is missing.<br>
Raises Prometheus.InvalidMetricNameError if metric name is invalid.<br>
Raises Prometheus.InvalidMetricHelpError if help is invalid.<br>
Raises Prometheus.InvalidMetricLabelsError if labels isn't a list.<br>
Raises Prometheus.InvalidLabelNameError if label name is invalid.<br>
Raises Prometheus.MFAlreadyExistsError if a boolean with
the same spec already exists.
Removes boolean series identified by spec.
Raises Prometheus.UnknownMetricError exception if a boolean
for spec can't be found.<br>
Raises Prometheus.InvalidMetricArityError exception if labels count mismatch.
Resets the value of the boolean identified by spec.
Raises Prometheus.UnknownMetricError exception if a boolean
for spec can't be found.<br>
Raises Prometheus.InvalidMetricArityError exception if labels count mismatch.
Sets the boolean identified by spec to value.
Valid "truthy" values:
true;false;0-> false;number > 0-> true;[]-> falsenon-empty list-> true;:undefined-> undefined
Other values will generate Prometheus.InvalidValueError error.
Raises Prometheus.InvalidValueError exception if value isn't
a boolean or :undefined.<br>
Raises Prometheus.UnknownMetricError exception if a boolean for spec
can't be found.<br>
Raises Prometheus.InvalidMetricArityError exception if labels count mismatch.
Toggles the boolean identified by spec to value.
Raises Prometheus.InvalidValueError exception if boolean is :undefined.<br>
Raises Prometheus.UnknownMetricError exception if a boolean for spec
can't be found.<br>
Raises Prometheus.InvalidMetricArityError exception if labels count mismatch.
Returns the value of the boolean identified by spec. If there is no boolean for
given labels combination, returns :undefined.
Raises Prometheus.UnknownMetricError exception if a boolean
for spec can't be found.<br>
Raises Prometheus.InvalidMetricArityError exception if labels count mismatch.