Simplify some route getters (#9316)

This commit is contained in:
Trask Stalnaker 2023-08-28 00:24:30 -07:00 committed by GitHub
parent 9f3ad5efda
commit 3cdcb2bbb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 7 additions and 11 deletions

View File

@ -34,8 +34,7 @@ class ServerDecorator extends SimpleDecoratingHttpService {
Context otelContext = Context.current();
HttpServerRoute.update(
otelContext, HttpServerRouteSource.SERVER, (context, name) -> name, matchedRoute);
HttpServerRoute.update(otelContext, HttpServerRouteSource.SERVER, matchedRoute);
try {
return unwrap().serve(ctx, req);

View File

@ -34,8 +34,7 @@ public final class FinatraSingletons {
}
public static void updateServerSpanName(Context context, RouteInfo routeInfo) {
HttpServerRoute.update(
context, HttpServerRouteSource.CONTROLLER, (c, route) -> route.path(), routeInfo);
HttpServerRoute.update(context, HttpServerRouteSource.CONTROLLER, routeInfo.path());
}
private FinatraSingletons() {}

View File

@ -41,8 +41,7 @@ public final class RatpackSingletons {
}
// update the netty server span name; FILTER is probably the best match for ratpack Handlers
HttpServerRoute.update(
otelContext, HttpServerRouteSource.SERVER_FILTER, (context, name) -> name, matchedRoute);
HttpServerRoute.update(otelContext, HttpServerRouteSource.SERVER_FILTER, matchedRoute);
return matchedRoute;
}

View File

@ -38,7 +38,7 @@ final class TracingFilter extends Filter {
scope = context.makeCurrent();
}
HttpServerRoute.update(context, CONTROLLER, (ctx, s) -> s, path);
HttpServerRoute.update(context, CONTROLLER, path);
Throwable statusThrowable = null;
try {

View File

@ -39,7 +39,7 @@ final class TracingFilter extends Filter {
scope = context.makeCurrent();
}
HttpServerRoute.update(context, CONTROLLER, (ctx, s) -> s, path);
HttpServerRoute.update(context, CONTROLLER, path);
Throwable statusThrowable = null;
try {

View File

@ -16,8 +16,7 @@ public final class SparkRouteUpdater {
public static void updateHttpRoute(@Nullable RouteMatch routeMatch) {
if (routeMatch != null) {
Context context = Context.current();
HttpServerRoute.update(
context, HttpServerRouteSource.CONTROLLER, (c, r) -> r.getMatchUri(), routeMatch);
HttpServerRoute.update(context, HttpServerRouteSource.CONTROLLER, routeMatch.getMatchUri());
}
}

View File

@ -110,7 +110,7 @@ public class VaadinHelper {
HttpServerRoute.update(
context,
HttpServerRouteSource.NESTED_CONTROLLER,
(c, loc) -> ServletContextPath.prepend(c, getSpanNameForLocation(loc)),
(ctx, loc) -> ServletContextPath.prepend(ctx, getSpanNameForLocation(loc)),
location);
}