View Source prometheus_metric behaviour (prometheus v5.0.0)
This module provides functions and types for managing Prometheus metrics in Erlang.
It includes functionality for inserting, deregistering, and checking metrics, as well as handling metric labels and data.
Summary
Types
Metric counter type
Metric duration unit type
Metric gauge type
Metric help type
Metric histogram type
Metric labels type
Metric name type
Metric specification type
Metric summary type
Metric value type
Callbacks
Inserts a new metric function into the table.
Inserts a new metric function into the table, fails if it already exists.
Removes a metric function by name.
Removes a metric function by name and label values.
Removes a metric function by registry, name, and label values.
Resets a metric function by name.
Resets a metric function by name and label values.
Resets a metric function by registry, name, and label values.
Sets the default metric function for the module.
Gets the value of a metric function by name.
Gets the value of a metric function by name and label values.
Gets the value of a metric function by registry, name, and label values.
Types
-type counter_value() :: number().
Metric counter type
-type duration_unit() :: prometheus_time:duration_unit().
Metric duration unit type
-type gauge_value() :: number().
Metric gauge type
-type help() :: binary() | nonempty_string().
Metric help type
Metric histogram type
-type labels() :: [name()].
Metric labels type
-type name() :: atom() | binary() | nonempty_string() | iolist().
Metric name type
-type spec() :: proplists:proplist().
Metric specification type
Metric summary type
-type value() :: counter_value() | gauge_value() | summary_value() | histogram_value() | undefined.
Metric value type
Callbacks
Inserts a new metric function into the table.
-callback new(Spec :: spec()) -> ok.
Inserts a new metric function into the table, fails if it already exists.
Removes a metric function by name.
Removes a metric function by name and label values.
-callback remove(Registry, Name, LValues) -> boolean() | no_return() when Registry :: prometheus_registry:registry(), Name :: name(), LValues :: list().
Removes a metric function by registry, name, and label values.
Resets a metric function by name.
Resets a metric function by name and label values.
-callback reset(Registry, Name, LValues) -> boolean() | no_return() when Registry :: prometheus_registry:registry(), Name :: name(), LValues :: list().
Resets a metric function by registry, name, and label values.
-callback set_default(Registry, Name) -> any() when Registry :: prometheus_registry:registry(), Name :: name().
Sets the default metric function for the module.
Gets the value of a metric function by name.
Gets the value of a metric function by name and label values.
-callback value(Registry, Name, LValues) -> value() | no_return() when Registry :: prometheus_registry:registry(), Name :: name(), LValues :: list().
Gets the value of a metric function by registry, name, and label values.