AI Observability (Spring AI)
Instruments Spring AI apps with token, latency, cost and prompt-audit telemetry using Micrometer and the GA advisor API.
Dev & CodingAdvanced★ 290⑂ 44AI score 9/10Last updated: Sep 21, 2026
What it does
- Adds Actuator + Prometheus dependencies and enables Spring AI 1.0+ built-in Micrometer metrics (
gen_ai.client.operation,gen_ai.client.token.usage,spring.ai.chat.client). - Supplies a custom metrics component that records prompt latency timers and token counters tagged by operation, model and input/output.
- Provides an audit advisor written against the GA API (
CallAdvisor,ChatClientRequest,ChatClientResponse,getCompletionTokens()), avoiding the removed milestone classes. - Defines cost-attribution rules: externally managed price tables with effective dates, reject unknown models, keep raw token usage for recalculation.
- Includes an
ai_audit_logJPA entity plus gotchas:@Asyncmust live on a separate bean, keeplog-prompt: falsein production for PII safety, track failed calls separately.
Who it's for
- Backend engineers shipping Spring Boot 3 + Spring AI features to production.
- Teams that need dashboards for LLM token consumption and estimated spend.
- Anyone tired of AI-generated Spring AI code that uses pre-GA advisor classes and won't compile.
Example uses
- "Expose ChatClient P95 latency and token usage to Prometheus" → generates endpoint exposure, histogram config and timer code.
- "Write an advisor that logs requestId, tokens and latency for every LLM call" → produces a GA-compliant
CallAdvisorimplementation. - "Track estimated cost per model" → externalized pricing design plus an audit table storing raw tokens and estimated cost.
· · · 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 Claude 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 && mkdir -p ~/.claude/skills && cp -r 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 and clone the repo:
git clone https://github.com/rrezartprebreza/spring-boot-skills.git - Create the skills directory:
mkdir -p ~/.claude/skills - Copy just this skill:
cp -r spring-boot-skills/skills/spring-boot-3/ai-observability ~/.claude/skills/ - Verify that
~/.claude/skills/ai-observability/SKILL.mdexists. - Restart Claude Code, then ask something like "add token and latency instrumentation to my ChatClient" inside a Spring AI project.
- For general service metrics, health endpoints and OTLP wiring, also copy the
production-observabilityskill from the same repo.
View source on GitHub ↗License: MIT