Conduit.Telemetry
Conduit.Telemetry — Phase 6 structured telemetry and middleware interfaces.
Architecture: • Conduit.Telemetry — event type + Vault-based handler registry + dispatch. • Conduit.TelemetryHandler(t) — interface for custom handlers (inside mod Conduit). • Conduit.Telemetry.Logger — built-in handler that writes events to the March logger. • Conduit.Middleware(m) — interface for job execution wrappers (inside mod Conduit). • Conduit.Middleware.Chain — helper for running a list of middleware closures.
Usage:
-- Attach the built-in Logger handler at startup:
Conduit.Telemetry.Logger.attach()
-- Or attach a custom closure directly:
Conduit.Telemetry.attach("my_metrics", fn event ->
match event do
Conduit.Telemetry.JobCompleted(_, duration_ms) ->
MyMetrics.histogram("job.duration", duration_ms)
_ -> ()
end)
-- Detach when no longer needed:
Conduit.Telemetry.detach("my_metrics")── Telemetry event type and dispatch ─────────────────────────────────────────
Types
Functions
Register a telemetry handler function under name.
The handler is called synchronously for every dispatched event in an
unspecified order relative to other registered handlers. Handlers must
be fast; offload long-running work to a separate task.
Registering under the same `name` replaces the previous handler.Attach the built-in Logger handler.
Registers under the name `"conduit.logger"`. Every event is logged at
INFO level as a single-line human-readable string. Call this once at
application startup:
Conduit.Telemetry.attach_logger()
To detach:
Conduit.Telemetry.detach("conduit.logger")Remove a previously registered handler by name. No-op if not found.
Dispatch an event to every registered handler.
Called by the Conduit engine at key lifecycle points. Handlers run
synchronously in the calling task's execution context; a panicking handler
will propagate to the worker task. Keep handlers free of blocking I/O.