The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mail::Milter::Authentication::Metric - Class for metrics generation

VERSION

version 2.20200319

DESCRIPTION

Handle metrics collection and production for prometheus

CONSTRUCTOR

new()

my $object = Mail::Milter::Authentication::Metric->new();

Create a new Mail::Milter::Authentication::Metric object This object is used to store, modify, and report metrics.

METHODS

set_handler($handler)

Set a reference to the current handler

handle_exception($exception)

If we have a handler, then pass any exception to that handlers exception handling

prom()

Return the prom object if available

set_versions( $server )

Setup version metrics

get_timeout()

Returns the current value of timeout for metrics operations.

clean_label($text)

Given a string, return a version of that string which is safe to use as a metrics label.

count($args)

Increment the metric for the given counter Called from the base handler, do not call directly. $server is the current handler object

 count_id - the name of the metric to act on

 labels - hashref of labels to apply

 server - the current server object

 count - number to increment by (defaults to 1)

set($args)

Set the metric for the given counter Called from the base handler, do not call directly. $server is the current handler object

 count_id - the name of the metric to act on

 labels - hashref of labels to apply

 server - the current server object

 count - number to increment by (defaults to 1)

send( $server )

Send metrics to the parent server process.

register_metrics( $hash )

Register a new set of metric types and help texts. Called from the master process in the setup phase.

Expects a hashref of metric description, keyed on metric name.

re_register_metric()

Re-register currently registered metrics to ensure backend metadata is correct

master_metric_update( $server )

Called in the master process to periodically update some metrics

child_handler( $server )

Handle a metrics or http request in the child process.

LOGGING METHODS

dbgout( $key, $value, $priority )

Pass arguments along to the dbgout method of the handler if we have one or log via the Mail::Milter::Authentication object if we do not.

AUTHOR

Marc Bradshaw <marc@marcbradshaw.net>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by Marc Bradshaw.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.