LangEx.Telemetry.OpenTelemetryBridge (LangEx v0.11.3)

Copy Markdown View Source

Optional OpenTelemetry bridge for LangEx telemetry spans.

Converts every LangEx span (graph invoke, super-step, node execution, LLM call, checkpoint save/load) into an OpenTelemetry span, preserving the parent/child structure within a process via OpentelemetryTelemetry context tracking. run_id/parent_run_id are attached as attributes, so cross-process node spans can still be correlated.

Only compiled when the optional opentelemetry_telemetry dependency is present. Attach once at application start:

LangEx.Telemetry.OpenTelemetryBridge.attach()

Summary

Functions

Attaches the bridge to all LangEx telemetry events.

Detaches the bridge.

Functions

attach()

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

Attaches the bridge to all LangEx telemetry events.

detach()

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

Detaches the bridge.