Agent skill

AI Observability

by rrezartprebreza in rrezartprebreza/spring-boot-skills

A skill your agent uses when adding Spring AI-specific model observations, token usage, latency, externally configured cost attribution, advisor telemetry, or protected prompt and completion logging.

MITAuto-check passedDevOps & Cloud

Install AI Observability

skills CLI
$ npx skills add rrezartprebreza/spring-boot-skills --skill ai-observability -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install rrezartprebreza/spring-boot-skills ai-observability --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/rrezartprebreza/spring-boot-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/spring-boot-3/ai-observability .claude/skills/ai-observability && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
ai-observability
GitHub stars
301
Token cost
~1.6k tokens
SKILL.md length
223 words
Files
6
Skills in repo
51
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when adding Spring AI-specific model observations, token usage, latency, externally configured cost attribution, advisor telemetry, or protected prompt and completion logging.

  • Adding Spring AI-specific model observations
  • SKILL.md covers Dependencies, Spring AI Built-in Observability, Custom AI Metrics and Prompt/Response Logging Advisor, plus 4 more sections
  • Runs Java scripts from its folder
  • Externally configured cost attribution

What it does

AI Observability is an agent skill from rrezartprebreza/spring-boot-skills. Use when adding Spring AI-specific model observations, token usage, latency, externally configured cost attribution, advisor telemetry, or protected prompt and completion logging. Use production-observability for general service metrics, health, logs, and OTLP setup.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files (for example `agents/openai.yaml`).

It sits in DevOps & Cloud, covering Observability and Backend development. It works with OpenTelemetry and Spring Boot. The repository describes itself as: Production-grade Claude Code and Codex skills for Spring Boot developers. The licence is MIT.

When your agent uses it

  • Adding Spring AI-specific model observations
  • Externally configured cost attribution
  • Advisor telemetry
  • Protected prompt and completion logging

Example prompts

  • “/ai-observability”

What it can do on your machine

Read from SKILL.md and the folder at commit f0c06a0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Java), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

AI Observability loads about 1.6k tokens when it runs. Until then it costs about 71 tokens; SKILL.md has 223 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~71
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from rrezartprebreza/spring-boot-skills at commit f0c06a0, republished under its MIT licence (© rrezartprebreza). 223 words, ~1,638 tokens.

Download SKILL.mdSave it as .claude/skills/ai-observability/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
ai-observability
description
Use when adding Spring AI-specific model observations, token usage, latency, externally configured cost attribution, advisor telemetry, or protected prompt and completion logging. Use production-observability for general service metrics, health, logs, and OTLP setup.

AI Observability

Dependencies

xml
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>

Spring AI Built-in Observability

Spring AI 1.0+ includes built-in Micrometer instrumentation:

yaml
spring:
  ai:
    chat:
      observations:
        log-prompt: true       # GA renamed include-prompt → log-prompt. OFF in prod (PII).
        log-completion: true   # GA renamed include-completion → log-completion
management:
  metrics:
    tags:
      application: order-service
  endpoints:
    web:
      exposure:
        include: health,prometheus,metrics

Auto-generated metrics (OpenTelemetry GenAI semantic conventions):

  • gen_ai.client.operation — model call latency, tagged with provider and model
  • gen_ai.client.token.usage — token counts (input/output/total)
  • spring.ai.chat.client — ChatClient-level operation timer/span

Custom AI Metrics

java
@Component
@RequiredArgsConstructor
public class AiMetrics {

    private final MeterRegistry meterRegistry;

    private final Timer.Builder promptTimer = Timer.builder("ai.prompt.latency")
        .description("LLM prompt latency");

    private final Counter.Builder tokenCounter = Counter.builder("ai.tokens.used")
        .description("Total tokens consumed");

    public <T> T track(String operation, String model, Supplier<T> call) {
        return Timer.builder("ai.prompt.latency")
            .tag("operation", operation)
            .tag("model", model)
            .register(meterRegistry)
            .recordCallable(() -> call.get());
    }

    public void recordTokens(String operation, String model, int inputTokens, int outputTokens) {
        Counter.builder("ai.tokens.used")
            .tag("operation", operation)
            .tag("model", model)
            .tag("type", "input")
            .register(meterRegistry)
            .increment(inputTokens);

        Counter.builder("ai.tokens.used")
            .tag("operation", operation)
            .tag("model", model)
            .tag("type", "output")
            .register(meterRegistry)
            .increment(outputTokens);
    }
}

Prompt/Response Logging Advisor

GA replaced the whole advisor API: CallAroundAdvisor → CallAdvisor, AdvisedRequest → ChatClientRequest, AdvisedResponse → ChatClientResponse, and Usage.getGenerationTokens() → getCompletionTokens(). Agents reliably generate the old one — it does not compile on 1.0.

java
@Component
public class AiAuditAdvisor implements CallAdvisor {

    private static final Logger log = LoggerFactory.getLogger(AiAuditAdvisor.class);

    @Override
    public ChatClientResponse adviseCall(ChatClientRequest request, CallAdvisorChain chain) {
        String requestId = UUID.randomUUID().toString();
        long start = System.currentTimeMillis();

        log.info("[AI-AUDIT] requestId={} promptLength={}",
            requestId, request.prompt().getUserMessage().getText().length());

        try {
            ChatClientResponse response = chain.nextCall(request);
            long latency = System.currentTimeMillis() - start;

            ChatResponse chatResponse = response.chatResponse();
            if (chatResponse != null && chatResponse.getMetadata() != null) {
                Usage usage = chatResponse.getMetadata().getUsage();
                log.info("[AI-AUDIT] requestId={} latencyMs={} inputTokens={} outputTokens={}",
                    requestId, latency,
                    usage.getPromptTokens(), usage.getCompletionTokens()); // GA: not getGenerationTokens()
            }
            return response;
        } catch (Exception e) {
            log.error("[AI-AUDIT] requestId={} FAILED after {}ms", requestId,
                System.currentTimeMillis() - start, e);
            throw e;
        }
    }

    @Override
    public String getName() { return "AiAuditAdvisor"; }

    @Override
    public int getOrder() { return Ordered.LOWEST_PRECEDENCE; }
}

Cost attribution

  • Keep provider prices in externally managed configuration with an effective date and currency.
  • Key prices by the exact provider model identifier returned in usage metadata.
  • Reject an unknown model instead of silently applying a default price.
  • Preserve the raw token usage so historical costs can be recalculated after pricing changes.
  • Prefer provider billing exports for invoices; application estimates are operational signals only.

Structured AI Audit Log (DB)

java
@Entity
@Table(name = "ai_audit_log")
public class AiAuditLog {
    @Id @GeneratedValue(strategy = GenerationType.UUID)
    private UUID id;
    private String operation;
    private String model;
    private int inputTokens;
    private int outputTokens;
    private double estimatedCostUsd;
    private long latencyMs;
    private boolean success;
    private Instant createdAt;
}

// Async to avoid blocking main flow
@Async
public void saveAuditLog(AiAuditLog log) {
    auditLogRepository.save(log);
}

application.yml — Full Observability

yaml
management:
  endpoints:
    web:
      exposure:
        include: health,prometheus,metrics,info
  metrics:
    distribution:
      percentiles-histogram:
        ai.prompt.latency: true  # enables P50/P95/P99
  tracing:
    sampling:
      probability: 1.0  # 100% trace sampling in dev, reduce in prod

logging:
  level:
    org.springframework.ai: DEBUG  # enable in dev only

Gotchas

  • Agent implements CallAroundAdvisor/AdvisedRequest — removed in GA; use CallAdvisor/ChatClientRequest
  • Agent calls usage.getGenerationTokens() — GA renamed it to getCompletionTokens()
  • Agent logs full prompts in production — keep log-prompt: false for PII safety
  • Agent skips async on audit saves — always @Async to avoid latency impact, and put the @Async method on a separate bean; calling it on this bypasses the proxy and runs synchronously
  • Agent hardcodes token pricing — extract to config, prices change
  • Agent misses failed calls in metrics — track errors separately with error tag

© rrezartprebreza, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files in skills/spring-boot-3/ai-observability of rrezartprebreza/spring-boot-skills.

  • SKILL.md
  • agents/openai.yaml
  • examples/bad-ai-audit-advisor.java
  • examples/good-ai-audit-advisor.java
  • templates/AiAuditAdvisor.java
  • templates/AiMetrics.java

Open the folder on GitHubat commit f0c06a0

Compare with similar skills

AI Observability next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

AI Observability compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
AI Observability this skillrrezartprebreza/spring-boot-skills301—~1.6kAutomated safety check: PassMIT
Otel Javaollygarden/opentelemetry-agent-skills106—~1.4kAutomated safety check: PassApache-2.0
Spring Boot ObservabilityHoangNguyen0403/agent-skills-standard572—~501Automated safety check: PassMIT
Otel Pythonollygarden/opentelemetry-agent-skills106—~911Automated safety check: PassApache-2.0
Otel Rubyollygarden/opentelemetry-agent-skills106—~924Automated safety check: PassApache-2.0
Motel Debugkitlangton/motel298—~2.2kAutomated safety check: PassMIT

Similar skills

  • Otel Java

    ollygarden/opentelemetry-agent-skills

    OpenTelemetry in Java — Javaagent zero-code instrumentation, Spring Boot Starter, manual autoconfigure SDK, declarative YAML configuration, BOM dependency management, sensitive-data capture and…

    106 GitHub stars~1.4k tokensUpdated today
    DevOps & CloudAuto-check passed
  • Spring Boot Observability

    HoangNguyen0403/agent-skills-standard

    Instrument Spring Boot with Micrometer metrics, distributed tracing, and structured logging.

    572 GitHub stars~501 tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Otel Python

    ollygarden/opentelemetry-agent-skills

    OpenTelemetry in Python — SDK setup, declarative config, zero-code instrumentation (opentelemetry-instrument, opentelemetry-distro), contrib auto-instrumentation, manual API, performance tuning…

    106 GitHub stars~911 tokensUpdated today
    DevOps & CloudAuto-check passed
  • Otel Ruby

    ollygarden/opentelemetry-agent-skills

    OpenTelemetry in Ruby — SDK setup, manual tracing, experimental metrics and logs, Bundler integration, contrib instrumentation for Rails/Rack/Sinatra/Sidekiq and other gems, propagation…

    106 GitHub stars~924 tokensUpdated today
    DevOps & CloudAuto-check passed
  • Motel Debug

    kitlangton/motel

    Debug applications with motel, a local OpenTelemetry ingest and query server.

    298 GitHub stars~2.2k tokensUpdated 1 mo ago
    DevOps & CloudAuto-check passed
  • Temps

    gotempsh/temps

    Manage, deploy, operate, and instrument applications with Temps.

    831 GitHub stars~2k tokensUpdated today
    DevOps & CloudAuto-check passed

More from rrezartprebreza/spring-boot-skills

All 51 skills in this repo
  • API Versioning

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when versioning Spring MVC or WebFlux APIs in Spring Boot 3 / Spring Framework 6.

    301 GitHub stars~516 tokensUpdated 19 days ago
    Auto-check passed
  • API Versioning

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when versioning Spring MVC or WebFlux APIs in Spring Boot 4 / Spring Framework 7.

    301 GitHub stars~643 tokensUpdated 19 days ago
    Auto-check passed
  • Container Native Deployment

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when packaging a Spring Boot 3 application as an OCI image or GraalVM native executable.

    301 GitHub stars~781 tokensUpdated 19 days ago
    Auto-check passed
  • Container Native Deployment

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when packaging Spring Boot 4 as an OCI image, JVM container, AOT application, or GraalVM native executable.

    301 GitHub stars~706 tokensUpdated 19 days ago
    Auto-check passed
  • Domain Driven Design

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when evolving aggregate invariants, value objects or domain events in an existing DDD-style Spring Boot 3 application, or when DDD is explicitly requested.

    301 GitHub stars~2.1k tokensUpdated 19 days ago
    Auto-check passed
  • Domain Driven Design

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when evolving aggregate invariants, value objects or domain events in an existing DDD-style Spring Boot 4 application, or when DDD is explicitly requested.

    301 GitHub stars~2.1k tokensUpdated 19 days ago
    Auto-check passed

Categories

Questions about AI Observability

What does AI Observability do?

A skill your agent uses when adding Spring AI-specific model observations, token usage, latency, externally configured cost attribution, advisor telemetry, or protected prompt and completion logging. AI Observability is an agent skill from rrezartprebreza/spring-boot-skills. Use when adding Spring AI-specific model observations, token usage, latency, externally configured cost attribution, advisor telemetry, or protected prompt and completion logging.

When should I use AI Observability?

AI Observability fits situations like: adding Spring AI-specific model observations; externally configured cost attribution; advisor telemetry; protected prompt and completion logging.

How do I install AI Observability in Claude Code?

Run `npx skills add rrezartprebreza/spring-boot-skills --skill ai-observability -a claude-code`. Or copy the skill folder (skills/spring-boot-3/ai-observability in rrezartprebreza/spring-boot-skills) into .claude/skills/ai-observability in your project. Claude Code loads it when a task matches its description.

How do I install AI Observability in Codex?

Run `npx skills add rrezartprebreza/spring-boot-skills --skill ai-observability -a codex`. Or copy the skill folder (skills/spring-boot-3/ai-observability in rrezartprebreza/spring-boot-skills) into .agents/skills/ai-observability in your project. Codex loads it when a task matches its description.

Can I use AI Observability in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add rrezartprebreza/spring-boot-skills --skill ai-observability -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/ai-observability, .gemini/skills/ai-observability, .github/skills/ai-observability and .opencode/skills/ai-observability in your project.

What does AI Observability need to run?

Going by SKILL.md and its folder, AI Observability needs Java for the scripts in its folder.

Does AI Observability access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is AI Observability safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does AI Observability use?

AI Observability is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does AI Observability use?

About 1.6k tokens (SKILL.md is roughly 6.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to AI Observability?

Skills that share tags, products or a category with AI Observability: Otel Java (ollygarden/opentelemetry-agent-skills, 106 stars), Spring Boot Observability (HoangNguyen0403/agent-skills-standard, 572 stars), Otel Python (ollygarden/opentelemetry-agent-skills, 106 stars) and Otel Ruby (ollygarden/opentelemetry-agent-skills, 106 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains AI Observability?

rrezartprebreza (a GitHub user) maintains it in rrezartprebreza/spring-boot-skills, which has 301 GitHub stars. The repository holds 51 skills in this directory. The repository was last updated on September 21, 2026.

Source: rrezartprebreza/spring-boot-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.