Software /
code /
prosody-modules
Changeset
6141:83adef4f7d2e
mod_spam_reporting: Add a metric
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 08 Jan 2025 09:20:56 +0100 |
parents | 6140:476717ab3cd9 |
children | 6142:fc521fb5ffa0 |
files | mod_spam_reporting/mod_spam_reporting.lua |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_spam_reporting/mod_spam_reporting.lua Wed Jan 08 09:18:42 2025 +0100 +++ b/mod_spam_reporting/mod_spam_reporting.lua Wed Jan 08 09:20:56 2025 +0100 @@ -5,6 +5,8 @@ local jid_prep = require "util.jid".prep; +local count_report = module:metric("counter", "received", "reports", "Number of spam and abuse reports submitted by users.", { "report_type" }); + module:depends("blocklist"); module:add_feature("urn:xmpp:reporting:0"); @@ -33,6 +35,7 @@ end if report_type then + count_report:with_labels(report_type):add(1); module:log("warn", "Received report of %s from JID '%s', %s", report_type, jid, reason or "no reason given"); module:fire_event(module.name.."/"..report_type.."-report", { origin = event.origin, stanza = event.stanza, jid = jid,