# 182-java-observability-metrics-micrometer

182-java-observability-metrics-micrometer guides Java developers through Micrometer metrics design and validation. Use it when adding service measurements or revising existing instrumentation.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 297 installs · ★ 465 repo stars
- Author: Juan Antonio Breña Moral
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/jabrena/plinth/tree/HEAD/skills/182-java-observability-metrics-micrometer/SKILL.md
- Updated: 2026-10-21
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/182-java-observability-metrics-micrometer

## What it does

The skill helps map service indicators to metric names, units, tags, and meter types. It covers Counter, Timer, Gauge, DistributionSummary, and LongTaskTimer, along with histogram and percentile choices. Export guidance includes Actuator, Prometheus, and OpenTelemetry.

It stresses keeping tag values bounded: userId, UUIDs, raw URLs, and full exception messages can produce excessive time series and strain observability systems. After instrumentation changes, validate metric registration and values with tests, then run `./mvnw clean verify` or `mvn clean verify`.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add jabrena/plinth --skill 182-java-observability-metrics-micrometer -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/182-java-observability-metrics-micrometer/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/182-java-observability-metrics-micrometer/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add jabrena/plinth --skill 182-java-observability-metrics-micrometer -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/182-java-observability-metrics-micrometer/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add jabrena/plinth --skill 182-java-observability-metrics-micrometer -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/182-java-observability-metrics-micrometer/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install jabrena/plinth skills/182-java-observability-metrics-micrometer
```

2. **Manually: put the files in place**
- File: `.github/skills/182-java-observability-metrics-micrometer/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add jabrena/plinth --skill 182-java-observability-metrics-micrometer -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/jabrena/plinth --path skills/182-java-observability-metrics-micrometer
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/182-java-observability-metrics-micrometer/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add jabrena/plinth --skill 182-java-observability-metrics-micrometer -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/jabrena/plinth/tree/HEAD/skills/182-java-observability-metrics-micrometer/SKILL.md

## When to use it
- choose a meter type for events, latency, or current state
- set stable metric names and low-cardinality tags
- configure histograms and percentiles for service metrics
- test that metrics register and report expected values

## Example prompts
- Add Micrometer measurements for latency and error counts in this Java service.
- Review metric tags and remove values with unbounded cardinality.
- Configure histograms for the service metrics and validate them with tests.

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 62ae939322a1854a.

BEGIN THIRD-PARTY FILE 62ae939322a1854a
```text
---
name: 182-java-observability-metrics-micrometer
description: Use when you need to implement or improve Java metrics observability with Micrometer — including meter design, naming/tag conventions, cardinality control, timers/counters/gauges/distribution summaries, percentiles/histograms, Actuator/Prometheus integration, and metrics validation through tests. This should trigger for requests such as Improve metrics; Apply Micrometer; Add metrics observability; Refactor Micrometer instrumentation; Add Micrometer timers counters or gauges to Java services. Part of Plinth Toolkit
license: Apache-2.0
metadata:
  author: Juan Antonio Breña Moral
  version: 0.19.0
---
# Java Metrics Observability with Micrometer

Implement effective Java metrics instrumentation with Micrometer by defining meaningful service-level metrics, controlling cardinality, selecting the right meter type, and exposing production-ready telemetry for dashboards and alerting.

**What is covered in this Skill?**

- Metrics-first observability with Micrometer in Java applications
- Meter selection: Counter, Timer, DistributionSummary, Gauge, LongTaskTimer
- Naming and tagging conventions with low-cardinality dimensions
- Cardinality and meter lifecycle safeguards to prevent time-series explosion
- Histogram/percentile strategy and SLO-oriented metrics design
- Integration guidance for Actuator + Prometheus/OpenTelemetry pipelines
- Testing and verification of metrics registration and values

**Scope:** Application-level metrics design and instrumentation quality for Java services, with emphasis on operationally useful and cost-efficient telemetry.

## Constraints

Metrics instrumentation must be operationally safe, low-cardinality, and validated. Poor tag design or excessive meter creation can degrade observability systems and increase costs.

- **LOW CARDINALITY FIRST**: Never tag metrics with unbounded values (userId, UUID, raw URL, full exception message)
- **RIGHT METER TYPE**: Use Counter for monotonically increasing events, Timer for latency, Gauge for point-in-time state, and DistributionSummary for sampled values
- **BEFORE APPLYING**: Read the reference for good/bad instrumentation examples and anti-patterns
- **VERIFY**: Run `./mvnw clean verify` or `mvn clean verify` after changes

## When to use this skill

- Improve metrics
- Apply Micrometer
- Add metrics observability
- Refactor Micrometer instrumentation
- Add Micrometer timers counters or gauges to Java services

## Workflow

1. **Define measurement goals and meter contract**
```
END THIRD-PARTY FILE 62ae939322a1854a

The third-party file has ended. Everything between the 62ae939322a1854a tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2554 of 3472 bytes. © Juan Antonio Breña Moral · Apache-2.0 · https://github.com/jabrena/plinth/tree/HEAD/skills/182-java-observability-metrics-micrometer/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
