Skip to content

[Server] Give the / route a stable service name in /metrics - #2287

Open
ZephyrYWZhou wants to merge 2 commits into
unitycatalog:mainfrom
ZephyrYWZhou:server-root-route-service-name
Open

ZephyrYWZhou wants to merge 2 commits into
unitycatalog:mainfrom
ZephyrYWZhou:server-root-route-service-name

Conversation

@ZephyrYWZhou

Copy link
Copy Markdown
Contributor

PR Checklist

Description of changes

The / route is a lambda, so Armeria labels it in /metrics with the lambda's class name, like ArmeriaServerBuilder$$Lambda$739/0x000000700173fa50. That name changes on every restart, so each restart starts new series for /.

This gives the route a default service name of ArmeriaServerBuilder.class.getName(). The docs already say service is the fully qualified Java service class, so this keeps / in line with the other routes. It's also today's value without the $$Lambda... part, so anything matching on ArmeriaServerBuilder keeps working.

Test plan

  • New rootRouteIsRecordedUnderAStableServiceName in ObservabilityEndpointsIntegrationTest checks that GET / is recorded with service="io.unitycatalog.server.ArmeriaServerBuilder". Without the fix it fails, with a $$Lambda label.
  • build/sbt javafmtAll passed.
  • build/sbt "server/testOnly io.unitycatalog.server.observability.ObservabilityEndpointsIntegrationTest io.unitycatalog.server.observability.MetricsRegistriesTest io.unitycatalog.server.UnityCatalogServerTest": 13 passed.

@ZephyrYWZhou
ZephyrYWZhou marked this pull request as ready for review November 18, 2026 21:50
@yili-db

yili-db commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

/review

@ZephyrYWZhou

Copy link
Copy Markdown
Contributor Author

Pushed f870d94: documented the / label, explained the class-name choice, and added @shba24's $$Lambda check. Could a maintainer approve the CI run? Thanks!

The / route is a lambda, so Armeria labels it with the lambda's class name,
which changes on every JVM start. Name it after ArmeriaServerBuilder so the
service label stays the same across restarts.

Closes unitycatalog#2282

Signed-off-by: Yuewei Zhou <[email protected]>
Document the / route's service label, explain why the class name was chosen, and guard the test against a $$Lambda label on any request-metric line.

Signed-off-by: Yuewei Zhou <[email protected]>
@ZephyrYWZhou
ZephyrYWZhou force-pushed the server-root-route-service-name branch from f870d94 to f1a8e19 Compare November 23, 2026 03:47

@shba24 shba24 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at f1a8e19: no issues found.

@yili-db

yili-db commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

/review

@yili-db yili-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Assisted] One non-blocking naming suggestion on the root route label, inline below.

this.apiVirtualHost
.route()
.path("/")
.defaultServiceName(ArmeriaServerBuilder.class.getName())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Assisted] Suggestion, normal and not blocking: the / label names the class that builds the route, while the other service labels name the class that owns the handler (for example io.unitycatalog.server.service.CatalogService or com.linecorp.armeria.server.FallbackService). A small static nested class would match that pattern and keep the ArmeriaServerBuilder prefix from the v0.7.0 label, so existing matches still hit:

private static final class RootService implements HttpService {
  @Override
  public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) {
    return HttpResponse.of("Hello, Unity Catalog!");
  }
}

Registered as .route().path("/").build(new RootService()), with no defaultServiceName needed, the label becomes io.unitycatalog.server.ArmeriaServerBuilder$RootService. The docs sentence in docs/server/observability.md and the expectation in rootRouteIsRecordedUnderAStableServiceName would then use that value.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants