Prometheus
Nauthilus has basic support for some Prometheus metrics.
dynamic_loader("nauthilus_prometheus")
local nauthilus_prometheus = require("nauthilus_prometheus")
Gauge vector
You must create a gauge vector first before using it. This should be done in an init script.
nauthilus_prometheus.create_gauge_vec
Creates a Prometheus gauge vector with specified name, help text, and labels.
Syntax
nauthilus_prometheus.create_gauge_vec(name, help, labels)
Parameters
name
(string): The name of the gauge vectorhelp
(string): Description text for the gauge vectorlabels
(table): A Lua table containing label names
Returns
None
Example
dynamic_loader("nauthilus_prometheus")
local nauthilus_prometheus = require("nauthilus_prometheus")
local name = "http_client_concurrent_requests_total"
local help = "Measure the number of total concurrent HTTP client requests"
local labels = { "service" }
nauthilus_prometheus.create_gauge_vec(name, help, labels)
nauthilus_prometheus.add_gauge
Adds a value to a gauge with specified labels.
Syntax
nauthilus_prometheus.add_gauge(name, value, labels)
Parameters
name
(string): The name of the gauge vectorvalue
(number): The value to add to the gaugelabels
(table): A Lua table containing label values
Returns
None
Example
dynamic_loader("nauthilus_prometheus")
local nauthilus_prometheus = require("nauthilus_prometheus")
local name = "some_gauge_name"
local value = 42
local labels = { "some label" }
nauthilus_prometheus.add_gauge(name, value, labels)
nauthilus_prometheus.sub_gauge
Subtracts a value from a gauge with specified labels.