Prometheus.ex v1.0.0-alpha3 Prometheus.Model

Helpers for working with Prometheus data model. For advanced users. Probably will be used with Prometheus.Collector.

Summary

Macros

Creates counter metric with value and labels

Creates counter metrics from mdata {labels, value} tuple list

Create Metric Family of type, name and help. collector.collect_metrics/2 callback will be called and expected to return individual metrics list

Creates gauge metric with value and labels

Creates gauge metrics from mdata {label, value} tuple list

Creates histogram metric with buckets, count, sum, and labels

Creates histogram metrics from mdata {labels, buckets, count, sum} tuple list

Creates summary metric with count, sum and labels

Creates summary metrics from mdata {labels, count, sum} tuple list

Macros

counter_metric(value, labels \\ [])

Creates counter metric with value and labels.

iex(15)> Prometheus.Model.counter_metric(100, [host: "example.com"])
{:Metric, [{:LabelPair, "host", "example.com"}], :undefined, {:Counter, 100},
:undefined, :undefined, :undefined, :undefined}
counter_metrics(mdata)

Creates counter metrics from mdata {labels, value} tuple list.

iex(14)> Prometheus.Model.counter_metrics([{[host: "example.com"], 100}])
[{:Metric, [{:LabelPair, "host", "example.com"}], :undefined, {:Counter, 100},
:undefined, :undefined, :undefined, :undefined}]
create_mf(name, help, type, collector, collector_data)

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(value, labels \\ [])

Creates gauge metric with value and labels

iex(13)> Prometheus.Model.gauge_metric(100, [host: "example.com"])
{:Metric, [{:LabelPair, "host", "example.com"}], {:Gauge, 100}, :undefined,
 :undefined, :undefined, :undefined, :undefined}
gauge_metrics(mdata)

Creates gauge metrics from mdata {label, value} tuple list.

iex(11)> Prometheus.Model.gauge_metrics([{[host: "example.com"], 100}])
[{:Metric, [{:LabelPair, "host", "example.com"}], {:Gauge, 100}, :undefined,
:undefined, :undefined, :undefined, :undefined}]
histogram_metric(buckets, count, sum, labels \\ [])

Creates histogram metric with buckets, count, sum, and labels.

histogram_metrics(mdata)

Creates histogram metrics from mdata {labels, buckets, count, sum} tuple list.

summary_metric(count, sum, labels \\ [])

Creates summary metric with count, sum and labels.

summary_metrics(mdata)

Creates summary metrics from mdata {labels, count, sum} tuple list.