Bloccs.Web.Telemetry.Handler (bloccs_web v0.1.0)

Copy Markdown View Source

Attaches to the [:bloccs, …] telemetry events and forwards normalized data to the Bloccs.Web.Telemetry.Collector. Runs in the emitting (Broadway) process, so it does the minimum — normalize and cast — and never blocks the pipeline.

It feeds two views:

  • Metrics — per-node rolling windows from :start / :stop / …
  • Flow — one event per message that crosses an edge. A node's [:bloccs, :emit] events (the edges it fired) are buffered in the process dictionary and flushed on :stop / :exception, paired with the node's outcome and latency. The handler runs in the node's process and a Broadway processor handles one message at a time, so the per-process buffer is race-free.

Summary

Functions

Attach this handler, forwarding to collector. Idempotent per id.

Functions

attach(id, collector)

@spec attach(atom(), pid() | atom()) :: :ok | {:error, :already_exists}

Attach this handler, forwarding to collector. Idempotent per id.

detach(id)

@spec detach(atom()) :: :ok | {:error, :not_found}