Skip to content

Latest commit

 

History

History
511 lines (282 loc) · 18.7 KB

prometheus_model_helpers.md

File metadata and controls

511 lines (282 loc) · 18.7 KB

Module prometheus_model_helpers

Helpers for working with Prometheus data model.

Description

For advanced users. Probably will be used with prometheus_collector.

Data Types


buckets() = [{prometheus_buckets:bucket_bound(), non_neg_integer()}, ...]

counter() = value() | {value()} | {labels(), value()}

gauge() = value() | {value()} | {labels(), value()}

histogram() = {buckets(), non_neg_integer(), value()} | {labels(), buckets(), non_neg_integer(), value()}

label_name() = term()

label_value() = term()

metrics() = tmetric() | [tmetric()]

pre_rendered_labels() = binary()

prometheus_boolean() = boolean() | number() | list() | undefined

summary() = {non_neg_integer(), value()} | {labels(), non_neg_integer(), value()}

untyped() = value() | {value()} | {labels(), value()}

value() = float() | integer() | undefined | infinity

Function Index

boolean_metric/1 Equivalent to boolean_metric(Labels, Value).
boolean_metric/2 Creates boolean metric with Labels and Value.
boolean_metrics/1Equivalent to lists:map(fun boolean_metric/1, Values).
counter_metric/1 Equivalent to counter_metric(Labels, Value).
counter_metric/2 Creates counter metric with Labels and Value.
counter_metrics/1Equivalent to lists:map(fun counter_metric/1, Specs).
create_mf/4 Create Metric Family of Type, Name and Help.
create_mf/5 Create Metric Family of Type, Name and Help.
gauge_metric/1 Equivalent to gauge_metric(Labels, Value).
gauge_metric/2 Creates gauge metric with Labels and Value.
gauge_metrics/1Equivalent to lists:map(fun gauge_metric/1, Values).
histogram_metric/1 Equivalent to histogram_metric(Labels, Buckets, Count, Sum).
histogram_metric/3Equivalent to histogram_metric([], Buckets, Count, Sum).
histogram_metric/4 Creates histogram metric with Labels, Buckets, Count and Sum.
histogram_metrics/1Equivalent to lists:map(fun histogram_metric/1, Specs).
label_pair/1 Creates prometheus_model:LabelPair'()' from {Name, Value} tuple.
label_pairs/1Equivalent to lists:map(fun label_pair/1, Labels).
metric_name/1 If Name is a list, looks for atoms and converts them to binaries.
summary_metric/1 Equivalent to summary_metric(Labels, Count, Sum).
summary_metric/2Equivalent to summary_metric([], Count, Sum).
summary_metric/3Equivalent to summary_metric([], Count, Sum, []).
summary_metric/4 Creates summary metric with Labels, Count and Sum.
summary_metrics/1Equivalent to lists:map(fun summary_metric/1, Specs).
untyped_metric/1 Equivalent to untyped_metric(Labels, Value).
untyped_metric/2 Creates untyped metric with Labels and Value.
untyped_metrics/1Equivalent to lists:map(fun untyped_metric/1, Values).

Function Details

boolean_metric/1


boolean_metric(Boolean) -> prometheus_model:'Metric'()

Equivalent to boolean_metric(Labels, Value).

boolean_metric/2


boolean_metric(Labels, Value) -> prometheus_model:'Metric'()

Creates boolean metric with Labels and Value.

boolean_metrics/1

boolean_metrics(Values) -> any()

Equivalent to lists:map(fun boolean_metric/1, Values).

counter_metric/1


counter_metric(Spec) -> prometheus_model:'Metric'()

Equivalent to counter_metric(Labels, Value).

counter_metric/2


counter_metric(Labels, Value) -> prometheus_model:'Metric'()

Creates counter metric with Labels and Value.

counter_metrics/1

counter_metrics(Specs) -> any()

Equivalent to lists:map(fun counter_metric/1, Specs).

create_mf/4


create_mf(Name, Help, Type, Metrics) -> MetricFamily

Create Metric Family of Type, Name and Help. Collector:collect_metrics/2 callback will be called and expected to return individual metrics list.

create_mf/5


create_mf(Name, Help, Type, Collector, CollectorData) -> MetricFamily

Create Metric Family of Type, Name and Help. Collector:collect_metrics/2 callback will be called and expected to return individual metrics list.

gauge_metric/1


gauge_metric(Gauge) -> prometheus_model:'Metric'()

Equivalent to gauge_metric(Labels, Value).

gauge_metric/2


gauge_metric(Labels, Value) -> prometheus_model:'Metric'()

Creates gauge metric with Labels and Value.

gauge_metrics/1

gauge_metrics(Values) -> any()

Equivalent to lists:map(fun gauge_metric/1, Values).

histogram_metric/1


histogram_metric(Histogram) -> prometheus_model:'Metric'()

Equivalent to histogram_metric(Labels, Buckets, Count, Sum).

histogram_metric/3

histogram_metric(Buckets, Count, Sum) -> any()

Equivalent to histogram_metric([], Buckets, Count, Sum).

histogram_metric/4


histogram_metric(Labels, Buckets, Count, Sum) -> Metric

Creates histogram metric with Labels, Buckets, Count and Sum.

histogram_metrics/1

histogram_metrics(Specs) -> any()

Equivalent to lists:map(fun histogram_metric/1, Specs).

label_pair/1


Creates prometheus_model:LabelPair'()' from {Name, Value} tuple.

label_pairs/1

label_pairs(B) -> any()

Equivalent to lists:map(fun label_pair/1, Labels).

metric_name/1


metric_name(Name) -> binary()
  • Name = atom() | binary() | [char() | iolist() | binary() | atom()]

If Name is a list, looks for atoms and converts them to binaries. Why iolists do not support atoms?

summary_metric/1


summary_metric(Summary) -> prometheus_model:'Metric'()

Equivalent to summary_metric(Labels, Count, Sum).

summary_metric/2

summary_metric(Count, Sum) -> any()

Equivalent to summary_metric([], Count, Sum).

summary_metric/3

summary_metric(Labels, Count, Sum) -> any()

Equivalent to summary_metric([], Count, Sum, []).

summary_metric/4


summary_metric(Labels, Count, Sum, Quantiles) -> prometheus_model:'Metric'()

Creates summary metric with Labels, Count and Sum.

summary_metrics/1

summary_metrics(Specs) -> any()

Equivalent to lists:map(fun summary_metric/1, Specs).

untyped_metric/1


untyped_metric(Untyped) -> prometheus_model:'Metric'()

Equivalent to untyped_metric(Labels, Value).

untyped_metric/2


untyped_metric(Labels, Value) -> prometheus_model:'Metric'()

Creates untyped metric with Labels and Value.

untyped_metrics/1

untyped_metrics(Values) -> any()

Equivalent to lists:map(fun untyped_metric/1, Values).