Skip to content
GitHubLog inStart free
cetra is not released yet. These docs describe the development version.

Google ADK

cetra reads the spans that Google’s Agent Development Kit emits itself, and the spans of OpenInference’s ADK instrumentation.

ADK emits OpenTelemetry spans through the global tracer provider. Install a provider that exports to cetra before you run the agent. This is the setup the fixtures were captured with, with the endpoint and the key changed.

from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
provider = TracerProvider()
provider.add_span_processor(
BatchSpanProcessor(
OTLPSpanExporter(
endpoint="http://localhost:8080/v1/traces",
headers={"Authorization": "Bearer <SK_CETRA_KEY>"},
)
)
)
trace.set_tracer_provider(provider)
# Build and run your ADK agent as usual, then:
provider.shutdown()

Replace <SK_CETRA_KEY> with your sk-cetra- API key. See Send OpenTelemetry.

With ADK’s own spans, a run with one tool produces:

  • an invocation span, and an agent span for the agent;
  • a chain span for each call_llm, with the model, the instructions and the tool declarations;
  • an llm span for each model call, with the provider, token counts and cost;
  • a tool span for each execute_tool.

The session ID of the ADK session is the cetra session. Streaming runs and runs with thinking enabled are captured, and reasoning tokens are added to the output count.

You can use openinference-instrumentation-google-adk instead. Its spans carry the session and the user, and the call_llm span is the llm span.

  • The fixtures were captured with google-adk 2.14.0 and google-genai 2.34.0, and with openinference-instrumentation-google-adk 1.1.0.
  • cetra-sdk has no instrument name for ADK.