com.arize:openinference-instrumentation-springAI artifact, registered as a Micrometer observation handler.
Prerequisites
- Java 17+ (Spring AI 1.0+ requires 17)
- An Arize AX account (sign up)
- An
OPENAI_API_KEYfrom the OpenAI Platform
Launch Arize
- 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
Add the dependencies tobuild.gradle:
Note the artifact name uses camelCase —
openinference-instrumentation-springAI, not spring-ai. That’s how it’s published on Maven Central.Configure credentials
Setup tracing
Spring AI plugs into the MicrometerObservationRegistry. The SpringAIInstrumentor is an observation handler that turns each Spring AI call into an OpenInference span. Wire it up in main:
Run Spring AI
Expected output
Verify in Arize
- Open your Arize AX space and select project
spring-ai-tracing-example. - You should see a new trace within ~30–60 seconds (Arize’s Java OTLP ingest is slightly slower than the Python path) containing a
generateLLM span with the prompt, response, model name (gpt-5.5), and token-usage attributes attached. - 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. Confirm
ARIZE_SPACE_IDandARIZE_API_KEYare set in the same shell that runsgradle run. 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 spans, but the request succeeded. Spring AI only emits observations when the chat model is built with an
observationRegistry. Make sure yourOpenAiChatModel.builder()chain includes.observationRegistry(registry)and that the registry has theSpringAIInstrumentorregistered as an observation handler. 401from OpenAI. VerifyOPENAI_API_KEYis set and has access togpt-5.5. Swapmodel("gpt-5.5")inOpenAiChatOptions.builder()for a model your key can call.- Spans dropped at JVM exit.
BatchSpanProcessorexports asynchronously. AlwaystracerProvider.forceFlush().join(...)andtracerProvider.shutdown().join(...)beforemainreturns. - Using Spring Boot. This guide targets a plain Spring AI library use-case (no
@SpringBootApplication). For a Spring Boot starter pattern with auto-configuration, see Arconia — it bundles Spring AI + OpenInference + OTel auto-config under one dependency.