changeset 4543:9377b5593cc7

mod_statistics_statsd: Remove obsolete module, use the newer built-in statsd provider
author Matthew Wild <mwild1@gmail.com>
date Sat, 17 Apr 2021 12:51:50 +0100
parents fb4a50bf60f1
children 64fa2dd34d43
files mod_muc_rai/mod_muc_rai.lua mod_statistics_statsd/mod_statistics_statsd.lua
diffstat 2 files changed, 2 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_rai/mod_muc_rai.lua	Tue Apr 13 23:53:53 2021 +0200
+++ b/mod_muc_rai/mod_muc_rai.lua	Sat Apr 17 12:51:50 2021 +0100
@@ -95,6 +95,7 @@
 local function get_last_room_message_id(room_jid)
 	local last_room_message_id = room_activity_cache:get(room_jid);
 	if last_room_message_id then
+		module:log("debug", "Last room message: %s (cached)", last_room_message_id);
 		return last_room_message_id;
 	end
 
@@ -113,6 +114,7 @@
 
 	local id = data();
 	room_activity_cache:set(room_jid, id);
+	module:log("debug", "Last room message: %s (queried)", id);
 	return id;
 end
 
--- a/mod_statistics_statsd/mod_statistics_statsd.lua	Tue Apr 13 23:53:53 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-local statsmanager = require "core.statsmanager";
-local udp = require "socket".udp();
-
-local server = module:get_option_string("statsd_server_ip", "127.0.0.1");
-local server_port = module:get_option_number("statsd_server_port", 8124);
-local max_datagram_size = module:get_option_number("statds_packet_size", 512);
-
-function push_stats(stats, meta)
-	local metric_strings, remaining_bytes = {}, max_datagram_size;
-	for name, value in pairs(stats) do
-		local value_meta = meta[name];
-		module:log("warn", "%s %s", name, tostring(value_meta));
-		--if not value_meta then
-			-- Simple value (gauge)
-			local metric_string = ("%s|%d|g"):format(name, value);
-			if #metric_string > remaining_bytes then
-				udp:sendto(table.concat(metric_strings, "\n"), server, server_port);
-				metric_strings, remaining_bytes = {}, max_datagram_size;
-			end
-			table.insert(metric_strings, metric_string);
-			remaining_bytes = remaining_bytes - (#metric_string + 1); -- +1 for newline
-		--end
-	end
-	if #metric_strings > 0 then
-		udp:sendto(table.concat(metric_strings, "\n"), server, server_port);
-	end
-end
-
-module:hook_global("stats-updated", function (event)
-	push_stats(event.changed_stats, event.stats_extra);
-end);
-
-function module.load()
-	local all, changed, extra = statsmanager.get_stats();
-	push_stats(all, extra);
-end