Tinkex.Telemetry (Tinkex v0.3.4)

View Source

Convenience helpers for wiring Tinkex telemetry into simple console logging or lightweight dashboards.

Summary

Functions

Attach a logger that prints HTTP and queue-state telemetry events to the console.

Detach a previously attached handler.

Initialize a telemetry reporter for a session.

Functions

attach_logger(opts \\ [])

@spec attach_logger(keyword()) :: term()

Attach a logger that prints HTTP and queue-state telemetry events to the console.

Returns the handler id so callers can detach it manually.

detach(handler_id)

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

Detach a previously attached handler.

init(opts)

@spec init(keyword()) :: {:ok, pid()} | :ignore | {:error, term()}

Initialize a telemetry reporter for a session.

Options:

  • :session_id (required) - The session ID
  • :config (required) - Tinkex.Config.t()
  • :enabled? - Override env flag (default: check TINKER_TELEMETRY)
  • :telemetry_opts - Options passed to Reporter.start_link/1

Returns {:ok, pid} on success, :ignore when disabled, or {:error, reason} on failure.

Treats {:error, {:already_started, pid}} as success.