Mediabot 3.2-dev moves forward on three important areas: Prometheus metrics, WHOIS-based user resolution, and automated testing.
This round of work is not just cosmetic. It finishes metrics that were still incomplete in 3.1, cleans up part of the legacy WHOIS pipeline, and adds a dedicated test suite for the metrics layer.
Mediabot::Metrics had already declared a large set of metrics, but several of them were still effectively dormant. In practice, they existed but were never updated outside of initialisation, which made the exported /metrics output incomplete and misleading for Grafana.
This has now been corrected.
Ten previously inactive metrics are now wired into real execution paths across multiple modules, including login handling, helpers, admin commands, the main bot logic, and mediabot.pl. As a result, the Prometheus endpoint now reflects much more of what the bot is actually doing in real time. :contentReference[oaicite:1]{index=1} :contentReference[oaicite:2]{index=2}
This includes things like:
PRIVMSG and NOTICEOne useful side effect is that Grafana dashboards built on top of these metrics now become much more trustworthy and informative. :contentReference[oaicite:3]{index=3}
A bug was also fixed in Mediabot::Metrics::_log().
The metrics layer was sending string levels such as "INFO" and "ERROR" to Mediabot::Log->log(), while the logger expects integers. Perl silently coerced those strings to 0, so the log level handling was wrong in practice.
_log() now normalises both string and numeric levels correctly, which makes internal Metrics logging behave as intended. :contentReference[oaicite:4]{index=4}
The old WHOIS-related code was still relying on getNickInfoWhois(), a legacy helper returning eight positional scalar values. It worked, but it was not a clean fit anymore for the more object-oriented direction of the codebase.
A new helper, get_user_from_whois($hostmask), has now been introduced in Helpers.pm. It uses the same matching logic as before, but returns a proper Mediabot::User object instead of a raw positional list. The WHOIS-triggered handlers in mediabot.pl now use this new approach. :contentReference[oaicite:5]{index=5}
This is a healthier direction for the project: more consistent APIs, less fragile code, and fewer legacy-style return values to keep mentally aligned.
During the WHOIS refactor, one ugly Switch.pm parsing edge case also surfaced.
Using nested if {} blocks with my declarations inside case blocks generated invalid Perl after Switch.pm source filtering. This has been worked around cleanly by replacing those nested blocks with ternary assignments, avoiding extra braces inside the case body. :contentReference[oaicite:6]{index=6}
It is the kind of detail that is easy to underestimate, but documenting it matters because it explains why the code now looks the way it does.
A dedicated test file, t/cases/05_metrics.t, has been added to cover Mediabot::Metrics more seriously.
The new suite checks:
_log() regression coverageset_build_info() behaviourThe nice part is that this test suite does not require a live IRC connection or a database, which makes it much more practical for repeatable validation. :contentReference[oaicite:7]{index=7}
This development pass updated the following areas:
Mediabot/Metrics.pmMediabot/LoginCommands.pmMediabot/Helpers.pmMediabot/AdminCommands.pmMediabot/Mediabot.pmmediabot.plt/cases/05_metrics.tThis is a good 3.2-dev step forward.
The metrics side is now much closer to being genuinely useful in production. The WHOIS path is cleaner and more consistent with the rest of the object-oriented codebase. And the new test coverage is exactly the kind of work that helps the project grow without breaking itself every time something gets modernised.
In other words: less dead instrumentation, less legacy glue, more structure.
That is the right direction for Mediabot.
You must be logged in to reply.