Anthropic.Telemetry (SkillKit v0.1.0)

Copy Markdown View Source

Telemetry integration for the Anthropic client.

All events are prefixed with [:anthropic].

Events

  • [:anthropic, :request, :start] — before an API request
  • [:anthropic, :request, :stop] — after a successful API request
  • [:anthropic, :request, :exception] — on request failure
  • [:anthropic, :rate_limited] — when a 429 triggers a retry

Summary

Functions

Executes a point-in-time telemetry event (no start/stop pairing).

Executes a <prefix>:start telemetry event and returns the monotonic start time.

Executes a <prefix>:stop telemetry event, measuring duration since start_time.

Functions

event(event, measurements, meta)

@spec event([atom()] | atom(), map(), map()) :: :ok

Executes a point-in-time telemetry event (no start/stop pairing).

event is a list of atoms appended to [:anthropic].

start(event, meta \\ %{}, extra_measurements \\ %{})

@spec start([atom()] | atom(), map(), map()) :: integer()

Executes a <prefix>:start telemetry event and returns the monotonic start time.

event is a list of atoms appended to [:anthropic] (e.g. [:request]). meta is the metadata map forwarded to :telemetry.execute/3. extra_measurements are merged with the :system_time measurement.

stop(event, start_time, meta \\ %{}, extra_measurements \\ %{})

@spec stop([atom()] | atom(), integer(), map(), map()) :: :ok

Executes a <prefix>:stop telemetry event, measuring duration since start_time.

start_time should be the value returned by start/3. extra_measurements are merged with the computed :duration.