ChannelClient.Telemetry (channel_client v0.1.1)

Copy Markdown

Telemetry events emitted by ChannelClient.

ChannelClient instruments its connection, message flow and channel operations with :telemetry spans and point events. Attach handlers to build metrics or traces — the start/stop/exception triples follow :telemetry.span conventions so APM agents (LiveDashboard, AppSignal, OpenTelemetry converters, etc.) can turn them into spans directly.

No payload contents are ever included in event metadata; only topics, events names, refs and sizes.

Event catalog

EventMeasurementsMetadataDescription
[:channel_client, :connection, :start]%{system_time}%{transport, url}A transport open attempt began
[:channel_client, :connection, :stop]%{duration}%{transport, url, result} (result: :ok | :error, plus reason on error)Open attempt finished
[:channel_client, :connection, :disconnected]%{}%{reason}The transport reported a disconnect
[:channel_client, :message, :out]%{payload_bytes}%{topic, event, ref}An encoded frame was queued for sending
[:channel_client, :message, :in]%{duration, payload_bytes}%{topic, event, ref, join_ref}A server frame was decoded
[:channel_client, :channel_join, :start]%{system_time}%{topic}ChannelClient.Channel.join/3,4 began (client side)
[:channel_client, :channel_join, :stop]%{duration}%{topic, result} (+ reason)Join finished; result: :ok or :error
[:channel_client, :push, :start]%{system_time}%{event}A synchronous push/4 began awaiting a reply
[:channel_client, :push, :stop]%{duration}%{event, result} (+ reason)Reply arrived; result: :ok or :error
[:channel_client, :push, :exception]%{duration}%{event, kind, reason, stacktrace}A push crashed or timed out

duration values are in native time units; convert with System.convert_time_unit/3.

Example

:telemetry.attach(
  "log-connections",
  [:channel_client, :connection, :stop],
  fn _name, measurements, metadata, _config ->
    Logger.info("connected=#{inspect(metadata.result)}")
  end,
  nil
)

Summary

Functions

Returns all event names emitted by ChannelClient.

Functions

events()

@spec events() :: [[atom(), ...]]

Returns all event names emitted by ChannelClient.