Skip to content

[Server] Expose per-endpoint latency and in-flight requests in /metrics #2256

Closed

Description

@shba24

Is your feature request related to a problem? Please describe.

Armeria already records HTTP metrics for every API endpoint under the http.server prefix:

ArmeriaServerBuilder meterRegistry(MeterRegistry meterRegistry) {
armeriaServerBuilder.meterRegistry(meterRegistry);
apiVirtualHost.decorator(
MetricCollectingService.newDecorator(MeterIdPrefixFunction.ofDefault("http.server")));
return this;
}

The registry then drops every http.server.* meter except the request counter:

public static PrometheusMetrics createPrometheus() {
PrometheusMeterRegistry registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
Predicate<Meter.Id> httpRequestCounter = id -> id.getName().equals("http.server.requests");
registry
.config()
.meterFilter(
MeterFilter.deny(
id -> id.getName().startsWith("http.server.") && !httpRequestCounter.test(id)))
.meterFilter(MeterFilter.forMeters(httpRequestCounter, MeterFilter.ignoreTags("result")));

The docs say so:

Within the `http_server_*` family, only `http_server_requests_total` is exposed, without a `result`
tag. HTTP latency, request/response size, timeout, and in-flight metrics are not exposed. JVM,
CPU, Armeria-internal, and UC metrics remain enabled.

For example, when createTable slows from 50 ms to 5 s, /metrics still shows only http_server_requests_total{method="createTable",...}. An operator can see how many requests ran, but not how long they took or how many are running now.

Describe the solution you would like

In MetricsRegistries.createPrometheus(), also allow two meters Armeria records:

  • http.server.total.duration: a timer per service, method and http_status, exposed as http_server_total_duration_seconds_count, _sum and _max. Keep Micrometer's default of no percentile histogram, so each endpoint adds three series.
  • http.server.active.requests: a gauge per service and method. Summing it gives total in-flight requests.

Keep denying the other http.server.* meters (request and response length, request and response duration, timeouts).

Update the metric families table and the paragraph after it in docs/server/observability.md, with an example series for each new family.

Tests go into the existing ObservabilityEndpointsIntegrationTest. Its scrape check accepts only the request counter today:

assertThat(response.body().lines().filter(line -> line.startsWith("http_server_")).toList())
.isNotEmpty()
.allSatisfy(
line ->
assertThat(line)
.startsWith("http_server_requests_total{")
.contains("service=", "method=", "http_status=")
.doesNotContain("result="));

Change it to accept the two new families, and assert that after a createCatalog call the scrape has a http_server_total_duration_seconds_count series with method="createCatalog" and a http_server_active_requests series. Run:

build/sbt "server/testOnly io.unitycatalog.server.observability.ObservabilityEndpointsIntegrationTest io.unitycatalog.server.observability.MetricsRegistriesTest io.unitycatalog.server.UnityCatalogServerTest"

Done when a scrape shows latency and in-flight series per endpoint, the docs list them, and these tests pass.

Additional context

The /metrics endpoint came from #1906. Connection-pool metrics are in #2257.

Activity

  1. added
    enhancement
    good first issue
    on Nov 16, 2026
  2. ZephyrYWZhou commented on Nov 17, 2026

    @ZephyrYWZhou
    Contributor

    Hey @shba24, I'd like to pick this one up if it's still open. Could you assign it to me please?

    My plan is to follow what you laid out in the issue description:

    • Let http.server.total.duration and http.server.active.requests through the filter in MetricsRegistries.
    • Update the metric families table in observability.md.
    • Extend ObservabilityEndpointsIntegrationTest to check both after a createCatalog call.

    This would be my first contribution to Unity Catalog, so I'm excited to dig in! 🙋

  3. added a commit that references this issue on Nov 19, 2026
    30b3f2d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions