Simplify some route getters (#9316)
This commit is contained in:
parent
9f3ad5efda
commit
3cdcb2bbb7
|
@ -34,8 +34,7 @@ class ServerDecorator extends SimpleDecoratingHttpService {
|
||||||
|
|
||||||
Context otelContext = Context.current();
|
Context otelContext = Context.current();
|
||||||
|
|
||||||
HttpServerRoute.update(
|
HttpServerRoute.update(otelContext, HttpServerRouteSource.SERVER, matchedRoute);
|
||||||
otelContext, HttpServerRouteSource.SERVER, (context, name) -> name, matchedRoute);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return unwrap().serve(ctx, req);
|
return unwrap().serve(ctx, req);
|
||||||
|
|
|
@ -34,8 +34,7 @@ public final class FinatraSingletons {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateServerSpanName(Context context, RouteInfo routeInfo) {
|
public static void updateServerSpanName(Context context, RouteInfo routeInfo) {
|
||||||
HttpServerRoute.update(
|
HttpServerRoute.update(context, HttpServerRouteSource.CONTROLLER, routeInfo.path());
|
||||||
context, HttpServerRouteSource.CONTROLLER, (c, route) -> route.path(), routeInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private FinatraSingletons() {}
|
private FinatraSingletons() {}
|
||||||
|
|
|
@ -41,8 +41,7 @@ public final class RatpackSingletons {
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the netty server span name; FILTER is probably the best match for ratpack Handlers
|
// update the netty server span name; FILTER is probably the best match for ratpack Handlers
|
||||||
HttpServerRoute.update(
|
HttpServerRoute.update(otelContext, HttpServerRouteSource.SERVER_FILTER, matchedRoute);
|
||||||
otelContext, HttpServerRouteSource.SERVER_FILTER, (context, name) -> name, matchedRoute);
|
|
||||||
return matchedRoute;
|
return matchedRoute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ final class TracingFilter extends Filter {
|
||||||
scope = context.makeCurrent();
|
scope = context.makeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpServerRoute.update(context, CONTROLLER, (ctx, s) -> s, path);
|
HttpServerRoute.update(context, CONTROLLER, path);
|
||||||
|
|
||||||
Throwable statusThrowable = null;
|
Throwable statusThrowable = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -39,7 +39,7 @@ final class TracingFilter extends Filter {
|
||||||
scope = context.makeCurrent();
|
scope = context.makeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpServerRoute.update(context, CONTROLLER, (ctx, s) -> s, path);
|
HttpServerRoute.update(context, CONTROLLER, path);
|
||||||
|
|
||||||
Throwable statusThrowable = null;
|
Throwable statusThrowable = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -16,8 +16,7 @@ public final class SparkRouteUpdater {
|
||||||
public static void updateHttpRoute(@Nullable RouteMatch routeMatch) {
|
public static void updateHttpRoute(@Nullable RouteMatch routeMatch) {
|
||||||
if (routeMatch != null) {
|
if (routeMatch != null) {
|
||||||
Context context = Context.current();
|
Context context = Context.current();
|
||||||
HttpServerRoute.update(
|
HttpServerRoute.update(context, HttpServerRouteSource.CONTROLLER, routeMatch.getMatchUri());
|
||||||
context, HttpServerRouteSource.CONTROLLER, (c, r) -> r.getMatchUri(), routeMatch);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class VaadinHelper {
|
||||||
HttpServerRoute.update(
|
HttpServerRoute.update(
|
||||||
context,
|
context,
|
||||||
HttpServerRouteSource.NESTED_CONTROLLER,
|
HttpServerRouteSource.NESTED_CONTROLLER,
|
||||||
(c, loc) -> ServletContextPath.prepend(c, getSpanNameForLocation(loc)),
|
(ctx, loc) -> ServletContextPath.prepend(ctx, getSpanNameForLocation(loc)),
|
||||||
location);
|
location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue