Spring Boot Actuator metrics: turning http.server.requests into SLIs

Spring Boot Actuator metrics: read http.server.requests, pick outcome and slo thresholds, then compute availability and latency SLIs in Prometheus.
Spring Boot Actuator metrics : transformer http.server.requests en SLI

Your team promised “99.5% of requests succeed” on the checkout API, and nobody can read that number inside the application. For a Java service, the counter already exists. Spring Boot Actuator metrics publish a metric called http.server.requests with no code at all. This article starts from an operations decision: what do you keep from that metric to build reliable SLIs?

The facts come from the Spring Boot documentation, read on 15 November 2026. I did not run the sample application: the configuration and queries below are examples to adapt and test yourself.

This is a different topic from the OpenTelemetry Java agent, which instruments without touching the application. Here you use what the framework already exposes.

Spring Boot Actuator metrics: what is already measured

Actuator relies on Micrometer, a metrics facade. The documentation says auto-configuration instruments every request handled by Spring MVC controllers and functional handlers. The metric is named http.server.requests by default; change the name with management.observations.http.server.requests.name.

Each request carries tags. The reference page lists them for Jersey; for MVC and WebFlux it points to the Spring Framework documentation, so check them on your version:

  • method: GET, POST and so on;
  • status: the HTTP code, such as 200 or 500;
  • outcome: the status family (SUCCESS, CLIENT_ERROR, SERVER_ERROR and so on);
  • uri: the URI template before substitution, such as /api/person/{id};
  • exception: the simple name of the exception thrown.

The outcome tag is the most useful one for an SLI, because you do not maintain a list of codes by hand. One trap the documentation mentions: an exception handled inside a controller does not always show up in the tags unless you set it as a request attribute.

Exposing and reading the metric

By default only health is exposed over HTTP: management.endpoints.web.exposure.include defaults to health. Add metrics, and prometheus if Prometheus scrapes the service. The Prometheus endpoint is /actuator/prometheus.

For a quick look, /actuator/metrics/http.server.requests accepts tag=KEY:VALUE filters. Use the Micrometer name (with dots), not the name normalised for Prometheus.

Three curl commands: reading http.server.requests filtered by outcome or by uri, then the Prometheus endpoint

From counter to SLI: three choices

1. Which requests count?

An availability SLI is the ratio of successful requests to valid requests. Decide in writing whether CLIENT_ERROR belongs in the numerator or the denominator. Also exclude probes (/actuator/health): they inflate traffic and hide a real outage. To pick indicators, see choosing your SLIs.

2. Which dimension do you keep?

The uri tag uses the template, which limits cardinality. Keep it to find the guilty route, but compute the global SLI without it. Add common tags (management.metrics.tags.*) such as application and stack to tell services apart.

3. How do you measure latency?

An average hides slow requests, so you need a distribution. The documentation offers three per-meter properties: percentiles-histogram (a histogram that aggregates across instances), percentiles (computed in the application, so not aggregable) and slo (a cumulative histogram with your own thresholds). For an SLI such as “95% of requests under 300 ms”, slo is the most direct: you choose the thresholds, so the series count stays low.

application.yml file: exposure of the health, metrics and prometheus endpoints, common tags application and stack, slo thresholds for http.server.requests

Computing the SLI with Prometheus

Micrometer normalises names for Prometheus: http.server.requests becomes a family named http_server_requests_seconds_* (count, sum, buckets). Check the exact names in the /actuator/prometheus output before writing rules: I did not re-read that convention on the cited page.

The file below defines two SLIs as recording rules: the share of requests without SERVER_ERROR, and the share faster than 300 ms (the threshold must be in your slo list). For naming conventions, see Prometheus recording rules.

Two Prometheus recording rules: ratio of requests without SERVER_ERROR and ratio of requests under 0.3 seconds over 5 minutes

How to check it works

  1. Call /actuator/metrics: http.server.requests should be listed.
  2. Trigger a deliberate 500, then read the metric again with tag=outcome:SERVER_ERROR: the count should rise.
  3. In /actuator/prometheus, look for the bucket lines matching your thresholds.
  4. Compare the computed ratio with a manual count over 5 minutes.

Best practices

  • Do not mix window lengths: steer the SLO over 28 or 30 days and alert on short windows (see burn-rate alerts).
  • Keep few slo thresholds: each one adds series.
  • Protect Actuator endpoints: expose only what you need.
  • Write down the definition of a “valid request” with the business.

Frequently asked questions

Do I need Prometheus to use Actuator?

No. Micrometer supports many systems (Dynatrace, OTLP and Prometheus among them), and the metrics endpoint works on its own. Prometheus is only a storage choice.

Why is my exception tag empty?

An exception handled inside a controller is not always recorded. The documentation says to set it as a request attribute so that it appears.

Percentiles or a histogram for latency?

Percentiles computed in the application cannot be aggregated across instances; a histogram can. For an SLI across several pods, prefer the histogram or slo thresholds.

Conclusion

The metric already exists: the work is deciding which requests count, which dimension to keep and which thresholds to publish. With outcome and slo thresholds you get two clean SLIs. To frame an SLO in another context, see SLOs in DQL. Source: Spring Boot, Actuator metrics.

span.observer is an independent blog, not affiliated with Dynatrace LLC, VMware/Broadcom (Spring) or the Prometheus Authors. Trademarks belong to their owners. Tools move fast: check the properties in the documentation for your version.

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
Faille React2Shell (CVE-2025-55182) : repérer et corriger la RCE de React Server Components

React2Shell vulnerability (CVE-2025-55182): find and fix the React Server Components RCE

Related Posts