Module notifier_metrics

Prometheus metric declarations and the counter every structured log event feeds into.

Description

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.

Labelled only by 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").

Function Index

count/2Increment the event counter for one structured log event.
delivery/2Count one per-device delivery outcome (ok, unregistered, ...).
setup/0Declare the counter(s) this module owns.

Function Details

count/2

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/2

delivery(Provider::atom(), Status::atom()) -> ok

Count one per-device delivery outcome (ok, unregistered, ...).

setup/0

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