Telemetry
Observability
In-process event bus for BEAM apps (Elixir Telemetry–shaped, no Hex dep).
Emit with execute, listen with attach. HTTP, Repo, Jobs, and Channels emit standard selm.* events automatically. Built-in aggregation feeds prometheus scrape text; recent powers the Ops page ring buffer.
Telemetry.execute
[ "selm", "http", "request", "stop" ]
[ ( "duration_ms", 12.5 ) ]
[ ( "status", "200" ), ( "method", "GET" ) ]
Telemetry.attach "log-http"
[ [ "selm", "http" ] ]
(\event measurements metadata ->
let
_ =
Debug.inspect "telemetry" ( event, measurements, metadata )
in
()
)Types
Event
type alias Event =
{ event : List String
, measurements : List (String, String)
, metadata : List (String, String)
, atMs : Int
}One buffered event from recent.
Examples
Telemetry.recent 20Values
execute
execute : List String -> List (String, Float) -> List (String, String) -> ()Emit an event. Names are path segments (["selm","http","request","stop"]). Measurements are numeric pairs; metadata is string pairs.
Examples
Telemetry.execute [ "selm", "custom", "tick" ] [ ( "n", 1 ) ] []attach
attach : String -> List (List String) -> (List String -> List (String, Float) -> List (String, String) -> ()) -> ()Register a handler for event prefixes. An empty prefix list matches all.
Examples
Telemetry.attach "ops" [ [ "selm", "jobs" ] ] handlerdetach
detach : String -> ()Remove a handler by id.
Examples
Telemetry.detach "ops"prometheus
prometheus : () -> StringPrometheus text exposition of aggregated selm.* counters and summaries.
Examples
Server.string 200 [] "text/plain; version=0.0.4" (Telemetry.prometheus ())recent
recent : Int -> List EventNewest buffered events (capped). Used by Ops pages and agents.
Examples
Telemetry.recent 50