Skip to main content
Spring AI is the Java/Spring port of LangChain-style LLM orchestration — model abstraction, tool calling, structured output, and prompt templates that integrate with Spring’s broader ecosystem. Arize AX captures every Spring AI chat-model call via the 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_KEY from the OpenAI Platform

Launch Arize

  1. Sign in to your Arize AX account.
  2. From Space Settings, copy your Space ID and API Key. You will set them as ARIZE_SPACE_ID and ARIZE_API_KEY below.

Install

Add the dependencies to build.gradle:
Note the artifact name uses camelCaseopeninference-instrumentation-springAI, not spring-ai. That’s how it’s published on Maven Central.

Configure credentials

Setup tracing

Spring AI plugs into the Micrometer ObservationRegistry. 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

  1. Open your Arize AX space and select project spring-ai-tracing-example.
  2. You should see a new trace within ~30–60 seconds (Arize’s Java OTLP ingest is slightly slower than the Python path) containing a generate LLM span with the prompt, response, model name (gpt-5.5), and token-usage attributes attached.
  3. 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.
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_ID and ARIZE_API_KEY are set in the same shell that runs gradle run. To confirm spans are being produced locally before troubleshooting export, add SimpleSpanProcessor.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 your OpenAiChatModel.builder() chain includes .observationRegistry(registry) and that the registry has the SpringAIInstrumentor registered as an observation handler.
  • 401 from OpenAI. Verify OPENAI_API_KEY is set and has access to gpt-5.5. Swap model("gpt-5.5") in OpenAiChatOptions.builder() for a model your key can call.
  • Spans dropped at JVM exit. BatchSpanProcessor exports asynchronously. Always tracerProvider.forceFlush().join(...) and tracerProvider.shutdown().join(...) before main returns.
  • 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.

Resources

Spring AI Documentation

OpenInference Spring AI Instrumentor (Maven Central)

OpenInference Spring AI Source

Spring AI Example (with tools + multi-turn)