liveBook · Manning

Performance

As explained in Quarkus in Action

A specification for exposing numerical measurements of application and system behavior.

Performance metrics expose numeric measurements of a running application. Unlike a health check’s up-or-down result, a metric can show how behavior changes over time: response time, request volume, memory use, or thread-pool occupancy. Monitoring systems can turn those values into charts, statistics, and threshold-based alerts. section 10.0 section 10.3

Choose a metric type that matches the measurement:

  • A counter counts occurrences and only increases; a gauge holds a value that can rise or fall. section 10.3.2
  • A timer measures operation duration; a distribution summary collects numeric values not necessarily tied to time. Both can report a maximum, count, and sum. section 10.3.2
  • Framework metrics describe general runtime behavior and are usually supplied automatically. Business metrics measure domain events, such as orders placed. section 10.3

In Quarkus, use the Micrometer extension for metrics. Its common API supports multiple monitoring backends. For Prometheus output, add `micrometer-registry-prometheus` with `quarkus extension add micrometer-registry-prometheus`, start the application, and inspect `/q/metrics`. Quarkus exposes built-in measurements there when Micrometer is enabled; Prometheus can periodically scrape the endpoint, and Grafana can query Prometheus to display dashboards. section 10.3.1 section 10.3.5 section 10.3.6

Add a business counter declaratively with `@Counted` on a CDI bean method: an interceptor increments it when the method is called. For more control, inject Micrometer’s `MeterRegistry` and call `meterRegistry.counter("orders").increment()`; the registry gets or creates that counter. The imperative approach is more flexible but more verbose. section 10.3.4

Count car registrations

Annotate the registration method with `@Counted(description = "Number of car registrations")`, then perform a registration. The exported counter can include the method, result, and exception as tags, making the measurement queryable by those dimensions. section 10.3.6 section 10.3.3

Tags distinguish measurements that share a name. For HTTP requests, method, path, and status tags support useful aggregation; each unique combination has its own measurement. Prefer dimensions with few distinct values: a user ID creates too many unique combinations. In the Prometheus response, `# HELP` and `# TYPE` lines describe a metric, while unprefixed lines carry values. section 10.3.3 section 10.3.6

Version compatibility matters: although MicroProfile 6.1 includes Metrics 5.1, Quarkus 3.15 supports only MicroProfile Metrics 4.0. Its compatible SmallRye Metrics extension is not recommended and is slated for removal; Micrometer is the preferred path. section 10.3.1

How Quarkus in Action covers it

How deep it goes
Defines metric types and dimensions, then implements collection and export; leaves the supplied Prometheus and Grafana deployment configuration unexplored.
Examples
Uses JVM uptime output, an Inventory service dashboard, and a counted car-registration method.
What it assumes
Assumes a running Quarkus application and CDI methods; introduces metric types and the monitoring flow before applying them.
What you can do after
Apply it via Quarkus Micrometer to expose built-in and business metrics for Prometheus scraping and Grafana visualization.
How it connects
Connects metrics to health checks, Micrometer, Prometheus, Grafana, and application observability.

Also explained in

Compare how 40 books explain performance →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quarkus in Action. The section links point to the parts of the book it draws on.