Codex.Telemetry (Codex SDK v0.3.0)

View Source

Telemetry helpers and default logging for Codex events.

Summary

Functions

Attaches the default logger to thread telemetry events.

Configures OpenTelemetry exporting if the required environment variables are present.

Emits a telemetry event with the given measurements and metadata.

Types

telemetry_event()

@type telemetry_event() :: [atom()]

Functions

attach_default_logger(opts \\ [])

@spec attach_default_logger(keyword()) :: :ok | {:error, :already_exists}

Attaches the default logger to thread telemetry events.

configure(opts \\ [])

@spec configure(keyword()) :: :ok

Configures OpenTelemetry exporting if the required environment variables are present.

Reads CODEX_OTLP_ENDPOINT and optional CODEX_OTLP_HEADERS from the provided :env map (defaults to System.get_env/0) and wires the exporter when set.

emit(event, measurements \\ %{}, metadata \\ %{})

@spec emit(telemetry_event(), map(), map()) :: :ok

Emits a telemetry event with the given measurements and metadata.