Prometheus metric declarations and the counter every structured log event feeds into.
Rather than hand-instrumenting each call site (notifier_apns,
notifier_fcm, notifier_token_handler, ...), a single counter
is incremented by notifier_metrics_logger_handler for
every ?LOG_*(#{what := _, ...}) call in the application — the
same structured events already flowing to your log store (see
notifier_apns, notifier_fcm) double as
the metric source, so a new log call site is automatically a new
metric with no extra code.
event (the what atom) and level — NOT by
anything request-scoped like event_id or token, which would
make the time series cardinality unbounded. Per-call tracing stays
in your log store; Prometheus answers rate/count questions ("how many
apns_send_failed in the last hour").
| count/2 | Increment the event counter for one structured log event. |
| delivery/2 | Count one per-device delivery outcome (ok, unregistered, ...). |
| setup/0 | Declare the counter(s) this module owns. |
count(Event::atom(), Level::atom()) -> ok
Event: The event name — the what field of the log report.
Level: The log level (info | warning | error | ...).
returns: ok, always — a metrics failure must never take down the
caller (in practice, the Logger handler calling this).
Increment the event counter for one structured log event.
delivery(Provider::atom(), Status::atom()) -> ok
Count one per-device delivery outcome (ok, unregistered, ...).
setup() -> ok
Declare the counter(s) this module owns. Idempotent — safe to
call more than once (e.g. across Common Test suites sharing a node).
Must run before count/2 is ever called or before /metrics
is first scraped.
Generated by EDoc