feat(prometheus-exporter): add metrics-pole for power metrics

This commit is contained in:
2025-09-19 21:52:53 +02:00
parent ac04fa2942
commit b74da1b542
8 changed files with 204 additions and 65 deletions

View File

@@ -0,0 +1,16 @@
local M = {}
--- Formats a name + table of labels as a Prometheus metric
--- @param name string
--- @param labels table
--- @param value number
function M.counter(name, labels, value)
local label_parts = {}
for k, v in pairs(labels) do
table.insert(label_parts, string.format('%s="%s"', k, v))
end
local label_str = table.concat(label_parts, ",")
return string.format("factorio_%s_total{%s} %d", name, label_str, value)
end
return M