hecate_plugin_metrics (hecate_sdk v0.6.2)
View SourcePlugin metrics facade.
Lightweight metrics using OTP counters (atomics-backed, lock-free) with an ETS registry. Each plugin gets its own counters reference with up to 64 metric slots.
Two metric types: counter — monotonically increasing (e.g. requests served) gauge — point-in-time value (e.g. last latency)
Plugins use macros from hecate_plugin.hrl: ?METRIC_INC(Name) — increment counter by 1 ?METRIC_ADD(Name, N) — increment counter by N ?METRIC_SET(Name, Val) — set gauge to Val
Summary
Functions
Remove all metrics for a plugin.
Increment a counter metric by N.
Set a gauge metric to Value.
Get all metrics for all plugins. Returns a list of maps with plugin, name, type, and value keys.
Get all metrics for a specific plugin.
Initialize metrics namespace for a plugin. Creates a counters reference with 64 slots. Safe to call multiple times (idempotent).
Functions
-spec cleanup(binary()) -> ok.
Remove all metrics for a plugin.
Increment a counter metric by N.
Set a gauge metric to Value.
-spec get_all() -> [map()].
Get all metrics for all plugins. Returns a list of maps with plugin, name, type, and value keys.
Get all metrics for a specific plugin.
-spec init(binary()) -> ok.
Initialize metrics namespace for a plugin. Creates a counters reference with 64 slots. Safe to call multiple times (idempotent).