# HG changeset patch # User Emmanuel Gil Peyrot # Date 1529612052 -7200 # Node ID 36770ae1148fc6234935ca88e8ef9bb8335a070f # Parent 888375de933cbc42654a4c25e69f9850badef51a mod_prometheus: Don’t shadow variables. [luacheck] diff -r 888375de933c -r 36770ae1148f mod_prometheus/mod_prometheus.lua --- a/mod_prometheus/mod_prometheus.lua Thu Jun 21 22:11:01 2018 +0200 +++ b/mod_prometheus/mod_prometheus.lua Thu Jun 21 22:14:12 2018 +0200 @@ -102,17 +102,17 @@ local response = event.response; response.headers.content_type = "text/plain; version=0.4.4"; - local response = {}; + local answer = {}; local timestamp = tostring(get_timestamp()); - for section, data in pairs(data.data) do - for key, value in pairs(data) do + for section, content in pairs(data.data) do + for key, value in pairs(content) do local name = "prosody_"..section.."_"..key; - t_insert(response, repr_help(name, "TODO: add a description here.")); - t_insert(response, repr_type(name, "gauge")); - t_insert(response, repr_sample(name, {}, value, timestamp)); + t_insert(answer, repr_help(name, "TODO: add a description here.")); + t_insert(answer, repr_type(name, "gauge")); + t_insert(answer, repr_sample(name, {}, value, timestamp)); end end - return table.concat(response, ""); + return table.concat(answer, ""); end function module.add_host(module)