ADK.Telemetry (adk_ex v1.1.0)

Copy Markdown View Source

Dual telemetry instrumentation for the ADK.

Emits both OpenTelemetry spans and Elixir :telemetry events for LLM calls, tool calls, and merged tool operations.

OpenTelemetry Spans

  • "call_llm" — wraps model generate_content calls
  • "execute_tool {name}" — wraps individual tool executions
  • "execute_tool (merged)" — marks the combined tool results event

:telemetry Events

  • [:adk_ex, :llm, :start | :stop | :exception]

  • [:adk_ex, :tool, :start | :stop | :exception]

Summary

Functions

Wraps an LLM call with a "call_llm" span and :telemetry events.

Emits a span for merged tool results.

Wraps a tool call with an "execute_tool {name}" span and :telemetry events.

Functions

span_llm_call(metadata, fun)

@spec span_llm_call(map(), (-> result)) :: result when result: var

Wraps an LLM call with a "call_llm" span and :telemetry events.

Metadata should include :model_name, :invocation_id, :session_id.

span_merged_tools(metadata)

@spec span_merged_tools(map()) :: :ok

Emits a span for merged tool results.

Metadata should include :event_id.

span_tool_call(metadata, fun)

@spec span_tool_call(map(), (-> result)) :: result when result: var

Wraps a tool call with an "execute_tool {name}" span and :telemetry events.

Metadata should include :tool_name, :function_call_id.