com.arize:openinference-instrumentation-adk-java Java agent decorates them in place with OpenInference span kinds, prompts and completions, tool arguments and results, token counts, and session and user IDs. Your agent code stays untouched — the only application-side change is registering a global OpenTelemetry SDK that points at Arize AX.
Prerequisites
- Java 17+ (Google ADK for Java is compiled to Java 17 bytecode) and Gradle 8+
- An Arize AX account (sign up)
- A
GOOGLE_API_KEYfrom Google AI Studio
Launch Arize AX
- Sign in to your Arize AX account.
- From Space Settings, copy your Space ID and API Key. You will set them as
ARIZE_SPACE_IDandARIZE_API_KEYbelow.
Install
The instrumentation is a-javaagent, not a library, so it is never on your compile classpath. Resolve the shaded all jar into its own Gradle configuration and hand it to the JVM at launch:
Configure credentials
Setup tracing
Java doesn’t separate setup from runtime the way Python or TypeScript do — both happen in the samemain method. Register the OpenTelemetry SDK first, then build your ADK objects:
Main never imports an OpenInference class. The agent rewrites ADK’s own telemetry methods at JVM startup, so instrumentation is entirely a launch-time concern.
Run Google ADK
Expected output
Verify in Arize AX
- Open your Arize AX space and select project
google-adk-java-tracing-example. - You should see a new trace within ~30–60 seconds (Arize’s Java OTLP ingest is slightly slower than the Python path) rooted at an
invocationchain span carryingsession.id,user.id, andagent.name, with anagent_run [weather_agent]agent span, twocall_llmLLM spans (the tool-call turn and the final answer, each withllm.model_name,llm.provider, messages, tool schemas, and token counts), and atool_call [getWeather]tool span holding the tool arguments and result. - If no traces appear, see Troubleshooting.
Check from the skill, CLI, or SDK
Confirm spans are actually reaching your Arize AX project. Use whichever fits your workflow — the skill and CLI work for any framework; the SDK check is shown for each language.- Arize skill (agent)
- AX CLI
- SDK
Install the Arize Skills plugin and let your coding agent check for you:Then prompt your agent:
Use the arize-trace skill to export and analyze recent traces from my project. Confirm spans are arriving, and summarize any errors or latency issues.
Troubleshooting
- No traces in Arize AX. Confirm
ARIZE_SPACE_IDandARIZE_API_KEYare set in the same shell that runsgradle run. The OTLP exporter logs atFINElevel — to surface delivery errors, addjava.util.logging.Logger.getLogger("io.opentelemetry").setLevel(Level.FINE)before initialization, or wire an SLF4J implementation. To confirm spans are being produced locally before troubleshooting export, addSimpleSpanProcessor.create(LoggingSpanExporter.create())as an extra processor — it prints every span to stderr. - No
OpenInference ADK instrumentation installedline at startup. The-javaagentnever reached the JVM. Under Gradle, check thattasks.named('run')setsjvmArgsand thatconfigurations.openinferenceAgentresolves —gradle dependencies --configuration openinferenceAgentshould list exactly one jar. - Agent installed, but spans have no OpenInference attributes. You are on an unsupported ADK version. The agent advises
com.google.adk.Telemetry, which ADK renamed tocom.google.adk.telemetry.Tracingin0.6.0; pincom.google.adk:google-adkto0.5.0or lower. The warningOpenInference ADK instrumentation failed to transform ...in the log confirms a matcher mismatch. - Spans appear, but prompts and responses are empty. Your application touched an ADK class before
buildAndRegisterGlobal()ran, so ADK captured a no-opGlobalOpenTelemetry. Move every ADK construction call after the tracer registration, including static initializers and dependency-injection graphs that buildLlmAgenteagerly. 401/403from Google. VerifyGOOGLE_API_KEYis set and enabled forgemini-2.5-flash. If bothGOOGLE_API_KEYandGEMINI_API_KEYare set, ADK logs a warning and usesGOOGLE_API_KEY.- Spans dropped at JVM exit.
BatchSpanProcessorexports asynchronously. AlwaystracerProvider.forceFlush().join(...)andtracerProvider.shutdown().join(...)beforemainreturns. For a long-running service, register a JVM shutdown hook instead. SLF4J(W): No SLF4J providers were found.Harmless, but it also hides the agent’s own install log line. AddruntimeOnly 'org.slf4j:slf4j-simple:2.0.17'tobuild.gradleto see it.