Scrivio Interview library
CodingFoundations6 min read · updated 12 November 2026

How do you see the 99th percentile latency of GET /orders/{id} through /actuator/metrics, and what must be configured for percentiles?

We ask for the http.server.requests metric filtered by tags: /actuator/metrics/http.server.requests?tag=uri:/orders/{id}&tag=method:GET. The uri tag holds the URI template, not the real path, so all orders share one series. By default that metric only gives count, total time and max; for a 99th percentile we must enable percentiles, either client-side with management.metrics.distribution.percentiles.http.server.requests=0.99 or as a histogram with management.metrics.distribution.percentiles-histogram.http.server.requests=true, which is what production monitoring usually scrapes through Prometheus.

Why this question is asked

Average latency hides the requests that hurt users. If 99 requests take 20 ms and one takes 3 seconds, the average looks fine while one user in a hundred waits three seconds, which is why service level objectives are usually written as percentiles. Interviewers ask this question to check whether we can find a specific endpoint's numbers in Actuator and whether we know why the percentile is not there out of the box. In this answer, we will recap what Spring Boot records for each request, query the metric for one endpoint, see why the uri tag uses the template, enable percentiles in both ways, and see how production systems compute them.

1A Quick Recap of http.server.requests

Spring Boot uses Micrometer, a library that records metrics in a neutral format and exports them to monitoring systems. For every HTTP request that Spring MVC or WebFlux handles, Boot records a timer, a meter that counts events and adds up their durations, named http.server.requests. Each recorded request carries tags, key-value labels such as method=GET, status=200, outcome=SUCCESS, exception=none and uri=/orders/{id}.

Every distinct combination of tag values is a separate time series. The /actuator/metrics endpoint lets us look at one metric and filter it by tags. We need it exposed first, with management.endpoints.web.exposure.include=health,metrics, since only health is exposed over HTTP by default.

2Querying One Endpoint's Latency

We pass one tag parameter per filter. The braces must be URL-encoded, or curl must be told not to treat them as its own pattern syntax with -g.

Shell
curl -g 'http://localhost:8080/actuator/metrics/http.server.requests?tag=uri:/orders/{id}&tag=method:GET'
{
"name": "http.server.requests",
"baseUnit": "seconds",
"measurements": [
{ "statistic": "COUNT", "value": 1520.0 },
{ "statistic": "TOTAL_TIME", "value": 41.3 },
{ "statistic": "MAX", "value": 1.84 }
],
"availableTags": [
{ "tag": "status", "values": ["200", "404"] },
{ "tag": "outcome", "values": ["SUCCESS", "CLIENT_ERROR"] },
{ "tag": "exception", "values": ["none"] }
]
}

Notice what we get: 1,520 requests, 41.3 seconds in total, so an average of about 27 ms, and a maximum of 1.84 seconds. The maximum is only kept for a short recent window, not since startup. There is no percentile anywhere. The availableTags section lists the other tags we could add as filters, for example tag=status:200 to see only successful calls.

3Why the uri Tag Holds the Template

The uri tag is /orders/{id}, the pattern from the @GetMapping, and not /orders/1001 or /orders/1002. The reason is cardinality, the number of distinct values a tag can take. Each distinct value creates a separate time series, and with a histogram each series becomes dozens of series. With real paths, a million orders would mean a million series for this one endpoint, which would exhaust the memory of the application and of the monitoring system.

Using the template keeps the number of values equal to the number of routes in the code, a small and fixed set. It also makes the numbers useful: we want the latency of the get order operation, not of order 1001. For requests that match no route, Boot uses a fixed value such as NOT_FOUND or UNKNOWN instead of the path, for the same reason.

4Enabling Percentiles

A timer does not keep every duration, so a percentile cannot be calculated afterwards from count and total. We have to tell Micrometer, up front, to track the distribution. There are two ways, and they are not the same thing.

Properties
# Option 1: client-side percentiles, computed inside the application
management.metrics.distribution.percentiles.http.server.requests=0.5,0.95,0.99
# Option 2: histogram buckets, for the monitoring system to compute percentiles
management.metrics.distribution.percentiles-histogram.http.server.requests=true
# With option 1 the percentiles appear as gauges tagged phi:
# GET /actuator/metrics/http.server.requests.percentile?tag=uri:/orders/{id}&tag=phi:0.99
# -> { "statistic": "VALUE", "value": 0.212 } // p99 is about 212 ms
Client-side percentiles versus histogram buckets
percentilespercentiles-histogram
Computed whereIn each application instanceIn the monitoring system
Visible in /actuator/metricsYes, as .percentile gaugesNot as a percentile
Combine across podsNoYes, add the buckets
Choose percentile laterNo, fixed in configYes, any percentile
Extra series per tag setOne per percentileOne per bucket, often dozens

With client-side percentiles, Micrometer keeps a small decaying sample in each instance and publishes the chosen percentiles as extra gauges. They are easy to read in /actuator/metrics, but they have one important limit: they cannot be combined across instances. The average of the p99 of ten pods is not the p99 of the service.

With percentiles-histogram, Micrometer publishes counts per latency bucket, for example how many requests took up to 10 ms, up to 25 ms and so on. Buckets from many pods can be added together, and the monitoring system then estimates any percentile from the combined buckets. The exact naming of the percentile gauge in the actuator output can differ between versions, so check your version if it does not appear as shown.

5How Production Systems Compute the p99

In production we rarely look at /actuator/metrics. It shows one instance, right now. Instead, a monitoring system such as Prometheus scrapes /actuator/prometheus from every pod every 15 or 30 seconds and stores the history. With percentiles-histogram enabled, the timer appears there as a set of _bucket series, and a query computes the percentile across all pods for any time window.

Java
# PromQL: p99 latency of GET /orders/{id} over the last 5 minutes, across all pods
histogram_quantile(0.99,
sum by (le) (
rate(http_server_requests_seconds_bucket{uri="/orders/{id}", method="GET"}[5m])
)
)
# -> 0.208 (seconds)

Notice that the sum by le adds the bucket counts of every pod before the percentile is computed, which is exactly what client-side percentiles cannot do. Because each histogram adds many series, I would enable it for the request timers that have latency objectives rather than for every timer in the application.

6Follow-up questions

Why is MAX sometimes zero even though there was traffic?

Micrometer keeps the maximum in a rolling window of a few minutes. If no request arrived during the latest window, the maximum is reported as zero even though the count since startup is large.

Can I set SLO buckets instead of the full histogram?

Yes. management.metrics.distribution.slo.http.server.requests=100ms,500ms publishes only those boundaries, so we can count how many requests were faster than 100 ms with very few extra series. It answers 'what fraction met the objective' cheaply, but it cannot estimate arbitrary percentiles.

How do I limit the histogram to one endpoint?

The distribution properties work per meter name, not per tag. To restrict buckets to one uri, we can register a MeterFilter that customises DistributionStatisticConfig only for timers whose uri tag matches, and leaves the others without a histogram.

7Conclusion

In this answer, we queried /actuator/metrics/http.server.requests with tag filters for uri and method, and saw that the uri tag uses the route template to keep cardinality low. We saw that the default timer only has count, total time and max, so percentiles must be enabled: client-side percentiles give per-instance gauges that cannot be combined, while percentiles-histogram publishes buckets that Prometheus can sum across pods and turn into a p99 with histogram_quantile.

What to say in the interviewAbout 70 seconds aloud

Open with

First I would expose the metrics endpoint and request /actuator/metrics/http.server.requests with two tag filters, tag=uri:/orders/{id} and tag=method:GET. The uri tag holds the route template, not the real path, because every distinct tag value is a separate time series, and real order ids would create one series per order.

Then, if they want more

Out of the box that request only shows COUNT, TOTAL_TIME and MAX, so there is no p99 yet. To get one, I have to turn on distribution tracking for that meter. If I just want to see it in Actuator, I set management.metrics.distribution.percentiles.http.server.requests=0.99, and Micrometer publishes a percentile gauge with a phi tag.

Those are computed inside each instance, so they cannot be averaged across pods. In production I would rather set percentiles-histogram for http.server.requests to true. Then the Prometheus endpoint exports histogram buckets, Prometheus scrapes every pod, and I compute the p99 with histogram_quantile over the summed bucket rates for that uri and method, across the whole service and any time window.

I would enable histograms only for the timers that back latency objectives, because each one adds dozens of series.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Spring Boot reference, Actuator
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "How do you see the 99th percentile latency of GET /orders/{id} through...": https://scrivio-interview-library.netlify.app/spring-boot/actuator/3677908b17/