comparison mod_prometheus/mod_prometheus.lua @ 3133:321fd53a3191

mod_prometheus: Put the name as a label, which fits better the usual Prosody model.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 22 Jun 2018 00:38:37 +0200
parents 4ef28b6b4e87
children 99ac6dda9878
comparison
equal deleted inserted replaced
3132:4ef28b6b4e87 3133:321fd53a3191
78 sect = sect:sub(13); 78 sect = sect:sub(13);
79 elseif sect:find("^mod_statistics_.") then 79 elseif sect:find("^mod_statistics_.") then
80 sect = sect:sub(16); 80 sect = sect:sub(16);
81 end 81 end
82 82
83 local key = escape_name("prosody_"..sect.."_"..name); 83 local key = escape_name("prosody_"..sect);
84 local field = { 84 local field = {
85 value = value, 85 value = value,
86 labels = {}, 86 labels = { ["type"] = name},
87 -- TODO: Use the other types where it makes sense. 87 -- TODO: Use the other types where it makes sense.
88 typ = (typ == "rate" and "counter" or "gauge"), 88 typ = (typ == "rate" and "counter" or "gauge"),
89 }; 89 };
90 if host then 90 if host then
91 field.labels.host = host; 91 field.labels.host = host;