macula_diagnostics (macula v3.13.0)

View Source

Structured event emission + per-process metric accumulation.

Phase 1 implementation: events go through OTP logger with a structured report; metrics live in the calling process's dictionary. Phase 7 upgrades to Prometheus / OpenTelemetry exporters without changing this module's public surface.

Topic namespacing convention:

  • _macula.* — protocol-layer events (SDK)
  • _hecate.* — station-layer events (Hecate-specific)

Summary

Functions

Emit a structured event at the default info level.

Emit a structured event at a specific level.

Emit a metric. counter increments are summed across calls; gauge values overwrite the previous reading.

Drop all metric entries from the calling process's dictionary.

Snapshot all metrics held by the calling process.

Types

level/0

-type level() :: debug | info | notice | warning | error.

metric_type/0

-type metric_type() :: counter | gauge.

sample/0

-type sample() :: {Name :: binary(), metric_type(), number()}.

Functions

event(Topic, Properties)

-spec event(binary(), map()) -> ok.

Emit a structured event at the default info level.

event(Level, Topic, Properties)

-spec event(level(), binary(), map()) -> ok.

Emit a structured event at a specific level.

metric(Name, _, N)

-spec metric(binary(), metric_type(), number()) -> ok.

Emit a metric. counter increments are summed across calls; gauge values overwrite the previous reading.

reset()

-spec reset() -> ok.

Drop all metric entries from the calling process's dictionary.

snapshot()

-spec snapshot() -> [sample()].

Snapshot all metrics held by the calling process.