Mercurial > prosody-modules
changeset 6381:268220ce0625
mod_prometheus: Switch to prosody.util.time.now() to get the current time
| author | Link Mauve <linkmauve@linkmauve.fr> |
|---|---|
| date | Fri, 30 Jan 2026 15:04:25 +0100 |
| parents | 919f26901b51 |
| children | 0371619d3851 |
| files | mod_prometheus/mod_prometheus.lua |
| diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_prometheus/mod_prometheus.lua Fri Jan 30 15:04:22 2026 +0100 +++ b/mod_prometheus/mod_prometheus.lua Fri Jan 30 15:04:25 2026 +0100 @@ -11,7 +11,7 @@ local tostring = tostring; local t_insert = table.insert; local t_concat = table.concat; -local socket = require "socket"; +local time_now = require "prosody.util.time".now; local statsman = require "core.statsmanager"; local get_stats = statsman.get_stats; local get_metric_registry = statsman.get_metric_registry; @@ -26,8 +26,8 @@ end local function get_timestamp() - -- Using LuaSocket for that because os.time() only has second precision. - return math.floor(socket.gettime() * 1000); + -- In milliseconds. + return math.floor(time_now() * 1000); end local function repr_help(metric, docstring)
