LangEx.Telemetry (LangEx v0.11.3)

Copy Markdown View Source

Telemetry events emitted by LangEx.

LangEx uses :telemetry to emit structured events at key points during graph execution. All span events follow the [prefix, :start], [prefix, :stop], [prefix, :exception] convention produced by :telemetry.span/3.

Run-tree correlation

Every span's metadata carries two extra keys:

KeyTypeDescription
:run_idString.t()Unique ID of this span
:parent_run_idString.t() | nilID of the enclosing span (nil at root)

Graph invoke → step → node → LLM/checkpoint spans form a tree, so a single invocation can be fully reconstructed from the event stream. Subgraph invokes appear as child invoke spans of the parent node. See LangEx.Telemetry.Runs and, for exporting to OpenTelemetry, LangEx.Telemetry.OpenTelemetryBridge.

Events

[:lang_ex, :graph, :invoke, :start]

Emitted when a graph invocation begins.

  • Measurements: %{system_time: integer(), monotonic_time: integer()}

  • Metadata:

    KeyTypeDescription
    :graph_idatom() | nilGraph identifier (first node key)
    :thread_idterm() | nilThread ID from config

[:lang_ex, :graph, :invoke, :stop]

Emitted when a graph invocation completes.

  • Measurements: %{duration: integer(), monotonic_time: integer()}

  • Metadata: same as start, plus:

    KeyTypeDescription
    :resultatom:ok, :interrupt, or :error

[:lang_ex, :graph, :invoke, :exception]

Emitted when a graph invocation raises.

  • Measurements: %{duration: integer(), monotonic_time: integer()}
  • Metadata: same as start, plus :kind, :reason, :stacktrace

[:lang_ex, :graph, :step, :start | :stop | :exception]

Emitted around each super-step.

  • Metadata:

    KeyTypeDescription
    :stepintegerSuper-step number
    :active_nodes[atom()]Nodes executing in this step

[:lang_ex, :node, :execute, :start | :stop | :exception]

Emitted around individual node execution.

  • Metadata:

    KeyTypeDescription
    :nodeatom()Node name

[:lang_ex, :llm, :chat, :start | :stop | :exception]

Emitted around LLM provider chat calls (inside ChatModel nodes).

  • Metadata:

    KeyTypeDescription
    :providermodule()LLM provider module
    :modelterm()Model name
    :message_countintegerNumber of messages sent
  • Stop metadata adds:

    KeyTypeDescription
    :statusatom:ok or :error

[:lang_ex, :checkpoint, :save, :start | :stop | :exception]

Emitted around checkpoint persistence.

  • Metadata:

    KeyTypeDescription
    :checkpointermodule()Checkpointer implementation
    :thread_idterm()Thread identifier

[:lang_ex, :checkpoint, :load, :start | :stop | :exception]

Emitted around checkpoint loading.

  • Metadata: same as :checkpoint, :save.

Summary

Functions

Returns all telemetry event name prefixes emitted by LangEx.

Functions

events()

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

Returns all telemetry event name prefixes emitted by LangEx.