SKILL.md### Instrument a Quarkus application with Micrometer - Getting Started - Add `quarkus-micrometer-registry-prometheus` for Prometheus metrics export via `/q/metrics`. - Do NOT add `quarkus-opentelemetry` unless you also need distributed tracing. Micrometer and OpenTelemetry are independent; mixing them without a reason only adds complexity. If you need both Micrometer APIs and OpenTelemetry export, use `quarkus-micrometer-opentelemetry` — it bridges Micrometer metrics to the OpenTelemetry SDK. - For local observability (Grafana dashboards), add the LGTM dev service. Do NOT hardcode exporter endpoints. This dev service detects the `quarkus-micrometer-registry-prometheus` extension and activates a scraper for it. Do NOT use the generic `quarkus-observability-devservices` — it does not include the LGTM stack. Use: ```xml <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-observability-devservices-lgtm</artifactId> <scope>provided</scope> </dependency> ``` ### Programmatic Metrics — Use MeterProvider Inject `MeterRegistry` via constructor. Create metrics with the builder pattern and `.withRegistry(registry)` to get a `MeterProvider`. This defers tag binding to the call site, so you define the metric shape once and add dynamic tags when recording: ```java @Path("/orders") public class OrderResource { private final io.micrometer.core.instrument.Meter.MeterProvider<Counter> orderCounter; public OrderResource(MeterRegistry registry) { orderCounter = Counter.builder("orders.placed") .description("Total orders placed") .withRegistry(registry); } @POST public Response placeOrder(Order order) { orderCounter.withTags(Tags.of("type", order.getType())).increment(); return processOrder(order); } } ``` Use `.withRegistry(registry)` instead of `.register(registry)` whenever possible — it defers tag binding to the call site via `.withTags()`, so you define the metric once instead of creating one meter per tag combination upfront. Available `MeterProvider` types: `Counter`, `Timer`, `LongTaskTimer`, `DistributionSummary`. A timer wraps the actual call. A distribution summary records the actual business value. A counter increments on the actual event. Do not wrap synthetic work — if removing the metric would leave an empty method, the metric has nothing real to measure. Example for `@Timed`: ```java // BAD — Thread.sleep is not real work @Timed("process.time") public void process() { Thread.sleep(100); } // GOOD — timer wraps actual business logic @Timed("process.time") public void process(Order order) { orderService.validate(order); orderService.save(order); } ``` ### Gauges — Must Reflect Live State A gauge reports the current value of something that can go up AND down (active connections, queue depth, cache size). If your value only increments, use a counter instead. When the state already lives in an object (a queue, a pool, a cache), pass that object an