Ingot.TelemetryHandler (Ingot v0.1.0)

View Source

Centralized telemetry handler for Ingot.

Subscribes to telemetry events from:

  • Ingot UI operations (LiveView mounts, label submissions)
  • ForgeClient and AnvilClient calls
  • Forge application events (sample creation, pipeline execution)
  • Anvil application events (label submission, queue stats)

Responsibilities:

  • Broadcast events to PubSub for LiveView updates
  • Structured logging for audit trail
  • (Future) Emit Prometheus metrics
  • (Future) Distributed tracing integration

Summary

Functions

Attach telemetry handler to all Ingot, Forge, and Anvil events.

Detach the telemetry handler.

Handle telemetry events and route them appropriately.

Functions

attach()

Attach telemetry handler to all Ingot, Forge, and Anvil events.

This should be called during application startup (in Application.start/2). Idempotent - if already attached, detaches and reattaches.

detach()

Detach the telemetry handler.

Useful for cleanup in tests or graceful shutdown. Always returns :ok, even if handler is not attached.

handle_event(event, measurements, metadata, config)

Handle telemetry events and route them appropriately.