-
Notifications
You must be signed in to change notification settings - Fork 12
Prometheus Scraper Support
Shamis Shukoor edited this page Jun 28, 2018
·
1 revision
- In
ddConfig
table set[{dderl,dderl_prometheus,prometheusIsEnabled}]
to true - Configure basic auth in prometheus using
[{dderl,dderl_prometheus,prometheusAuth}]
in ddConfig table
- Metrics can be configured using
[{dderl,dderl_prometheus,prometheusMetrics}]
key in ddConfig. The default value is#{data_nodes => #{help => "Number of nodes in the cluster",labels => ["node","schema"],type => gauge}, memory => #{help => "Memory",labels => ["node","schema"],type => gauge}, port_count => #{help => "Number of Ports used",labels => ["node","schema"],type => gauge}, process_count => #{help => "Process Count",labels => ["node","schema"],type => gauge}, run_queue => #{help => "Run Queue Size",labels => ["node","schema"],type => gauge}}
- type should be one of guage, histogram, counter, summary orboolean
- help is a string or binary describing the metrics
- key is the name of the metric for example
data_nodes
- labels(optional) correspond to the prometheus metric labels. Should be a list of string/binary
- buckets(optional) can be used with histogram and summary
- duration_unit(optional) can be used with summar
-
This is the function that is being executed to fetch the mertics when the scraper is invoked
-
Following is the default function. This can be changed by editing the value for key
[{dderl,dderl_prometheus,prometheusMetricsFun}]
fun (Config) -> #{data_nodes := DNodes} = imem_metrics:get_metric(data_nodes), #{port_count := Ports, process_count := Procs, erlang_memory := Memory, run_queue := RunQ} = imem_metrics:get_metric(system_information), Labels = [node(), imem_meta:schema()], maps:fold(fun (memory, _V, Acc) -> Acc#{memory => {Labels, Memory}}; (process_count, _V, Acc) -> Acc#{process_count => {Labels, Procs}}; (port_count, _V, Acc) -> Acc#{port_count => {Labels, 100}}; (run_queue, _V, Acc) -> Acc#{run_queue => {Labels, RunQ}}; (data_nodes, _V, Acc) -> Acc#{data_nodes => {Labels, length(DNodes)}}; (K, V, Acc) -> Acc end, #{}, Config) end
- When using labels with a metrics expected result is a two tuple with first element a list a labels and then the value. The default function uses node and schema as labels.
- If not using labels in then the just the metrics value can be returned.