AI Observability (Spring AI)
Adds token usage, latency, cost attribution, and prompt audit telemetry to Spring AI apps using the correct 1.0 GA APIs.
Dev & CodingAdvanced★ 367⑂ 57AI score 9/10Last updated: Nov 17, 2026
What it does
- Configures
application.ymlto expose Spring AI 1.0+ built-in Micrometer instrumentation (gen_ai.client.operation,gen_ai.client.token.usage,spring.ai.chat.client). - Implements custom latency timers and token counters on
MeterRegistry, tagged by model and operation. - Ships an audit advisor written against the post-GA API (
CallAroundAdvisor→CallAdvisor,AdvisedRequest→ChatClientRequest,getGenerationTokens()→getCompletionTokens()). - Keeps prompt/completion logging off by default for PII safety and pushes model pricing into externally managed config with effective dates.
- Persists audit rows via a separate
@Asyncbean, with guidance on bounded executors and rejected-task monitoring.
Who it's for
- Backend engineers shipping LLM features on Spring Boot 3 + Spring AI.
- Platform/SRE teams that need dashboards for token spend and model latency.
- Teams in regulated environments that must audit AI calls.
Examples
- "Export P95 latency and token usage for my ChatClient to Prometheus" → actuator/Micrometer config plus percentile histograms.
- "Build an audit advisor for AI calls" → a GA-correct
CallAdvisorlogging requestId, tokens, and latency. - "Aggregate estimated cost per model" → externalized pricing table that rejects unknown models instead of defaulting.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/rrezartprebreza/spring-boot-skills/HEAD/skills/spring-boot-3/ai-observability/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on AI Skill Mart. Copy the skills/spring-boot-3/ai-observability folder from the GitHub repo rrezartprebreza/spring-boot-skills into my ~/.claude/skills/ai-observability/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/rrezartprebreza/spring-boot-skills.git /tmp/spring-boot-skills && mkdir -p ~/.claude/skills && cp -r /tmp/spring-boot-skills/skills/spring-boot-3/ai-observability ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal.
- Clone the repo:
git clone https://github.com/rrezartprebreza/spring-boot-skills.git - Create the skills folder:
mkdir -p ~/.claude/skills - Copy the skill:
cp -r spring-boot-skills/skills/spring-boot-3/ai-observability ~/.claude/skills/ - Verify with
ls ~/.claude/skills/ai-observability— you should seeSKILL.mdand atemplates/folder. - Restart Claude Code and try a prompt like "add token usage metrics to my Spring AI service".
View source on GitHub ↗License: MIT