Skip to content

[Server] The / route's service label in /metrics changes on every restart #2282

Open

Description

@ZephyrYWZhou

Describe the bug

The API host serves / with a lambda:

this.apiVirtualHost.service("/", (ctx, req) -> HttpResponse.of("Hello, Unity Catalog!"));

The route has no default service name, so Armeria falls back to the lambda's class name for the service label. The JVM makes that name up at startup, so it changes on every restart. Two runs, one GET / each:

http_server_requests_total{hostname_pattern="*:18080",http_status="200",method="GET",service="io.unitycatalog.server.ArmeriaServerBuilder$$Lambda$739/0x000000700173fa50"} 1.0
http_server_requests_total{hostname_pattern="*:18080",http_status="200",method="GET",service="io.unitycatalog.server.ArmeriaServerBuilder$$Lambda$736/0x000000700173e1b8"} 1.0

Every restart gives / a new service value, which means new series in Prometheus. The old ones go stale, series keep piling up, and any dashboard or alert on / stops matching after a restart. This hits http_server_requests_total today, and the latency and in-flight meters from #2266 too.

To Reproduce

  1. bin/start-uc-server --port 18080 --obs-port 19464
  2. curl http://127.0.0.1:18080/
  3. curl -s http://127.0.0.1:19464/metrics | grep 'method="GET"'
  4. Restart the server and repeat steps 2-3. The service label is different.

Expected behavior

The / route has a fixed service label that stays the same across restarts.

Additional context

The other routes on the API host are named classes (the annotated *Service classes, and DocService for /docs), so only / is affected.

A possible fix is to give the route a default service name:

this.apiVirtualHost
    .route()
    .path("/")
    .defaultServiceName("root")
    .build((ctx, req) -> HttpResponse.of("Hello, Unity Catalog!"));

plus a test that scrapes after GET / and checks for no $$Lambda in any service label. Open question: what should the value be? root is short, while something like io.unitycatalog.server.Root would match how the other services are named.

Found during review of #2266 (thanks @yili-db).

Activity

  1. added
    bug
    on Nov 21, 2026
  2. shba24 commented on Nov 21, 2026

    @shba24
    Collaborator

    Thank you @​ZephyrYWZhou for this report. You traced the unstable service label on the root route's metrics to the bare lambda in ArmeriaServerBuilder, and you included both scraped label values and a clear test idea.

    We reproduced it on current main. A new test, ObservabilityEndpointsIntegrationTest.rootRouteIsNotMeteredUnderALambdaClassName, sends a GET to / and scrapes the request metrics. It fails on this assertion: .allSatisfy(line -> assertThat(line).doesNotContain("$$Lambda")). The offending line was http_server_requests_total{...,service="io.unitycatalog.server.ArmeriaServerBuilder$$Lambda$1330/0x00007d292c8397c0"} 1.0.

    The server area owners will take it from here. If you would like to send a fix that gives the root route a fixed service name, that test is a good starting point.

  3. ZephyrYWZhou commented on Nov 23, 2026

    @ZephyrYWZhou
    ContributorAuthor

    Thanks @shba24! Opened #2287 with the fix, and used your test idea: it checks no request-metric line has a $$Lambda label after GET /.

  4. added a commit that references this issue on Nov 23, 2026
    2d731a6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions