Repository navigation
[Server] Give the / route a stable service name in /metrics - #2287
ZephyrYWZhou wants to merge 2 commits into
Conversation
|
/review |
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]>
f870d94 to
f1a8e19
Compare
|
/review |
yili-db
left a comment
There was a problem hiding this comment.
[AI Assisted] One non-blocking naming suggestion on the root route label, inline below.
| this.apiVirtualHost | ||
| .route() | ||
| .path("/") | ||
| .defaultServiceName(ArmeriaServerBuilder.class.getName()) |
There was a problem hiding this comment.
[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.
PR Checklist
docsis updatedDescription of changes
The
/route is a lambda, so Armeria labels it in/metricswith the lambda's class name, likeArmeriaServerBuilder$$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 sayserviceis 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 onArmeriaServerBuilderkeeps working.Test plan
rootRouteIsRecordedUnderAStableServiceNameinObservabilityEndpointsIntegrationTestchecks thatGET /is recorded withservice="io.unitycatalog.server.ArmeriaServerBuilder". Without the fix it fails, with a$$Lambdalabel.build/sbt javafmtAllpassed.build/sbt "server/testOnly io.unitycatalog.server.observability.ObservabilityEndpointsIntegrationTest io.unitycatalog.server.observability.MetricsRegistriesTest io.unitycatalog.server.UnityCatalogServerTest": 13 passed.