Reorganize server observability packages
Prior to this commit, the server observability support would create a cycle in Java packages. This commit refactors the current arrangement to solve this by: * "flattening" the reactive HTTP instrumentation; this removes the dependency to the `ServerWebExchange` and `PathPattern` types * moving the `observation` package under `org.springframework.http.server` and `org.springframework.http.server.reactive` See gh-29477
This commit is contained in:
@@ -172,7 +172,7 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini
|
||||
if (matchingPattern != null) {
|
||||
attributes.put(BEST_MATCHING_PATTERN_ATTRIBUTE, matchingPattern);
|
||||
ServerHttpObservationFilter.findObservationContext(serverRequest.exchange())
|
||||
.ifPresent(context -> context.setPathPattern(matchingPattern));
|
||||
.ifPresent(context -> context.setPathPattern(matchingPattern.toString()));
|
||||
}
|
||||
Map<String, String> uriVariables =
|
||||
(Map<String, String>) attributes.get(RouterFunctions.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
|
||||
|
||||
@@ -167,7 +167,7 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping {
|
||||
exchange.getAttributes().put(BEST_MATCHING_HANDLER_ATTRIBUTE, handler);
|
||||
exchange.getAttributes().put(BEST_MATCHING_PATTERN_ATTRIBUTE, pattern);
|
||||
ServerHttpObservationFilter.findObservationContext(exchange)
|
||||
.ifPresent(context -> context.setPathPattern(pattern));
|
||||
.ifPresent(context -> context.setPathPattern(pattern.toString()));
|
||||
exchange.getAttributes().put(PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, pathWithinMapping);
|
||||
exchange.getAttributes().put(URI_TEMPLATE_VARIABLES_ATTRIBUTE, matchInfo.getUriVariables());
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
|
||||
exchange.getAttributes().put(BEST_MATCHING_HANDLER_ATTRIBUTE, handlerMethod);
|
||||
exchange.getAttributes().put(BEST_MATCHING_PATTERN_ATTRIBUTE, bestPattern);
|
||||
ServerHttpObservationFilter.findObservationContext(exchange)
|
||||
.ifPresent(context -> context.setPathPattern(bestPattern));
|
||||
.ifPresent(context -> context.setPathPattern(bestPattern.toString()));
|
||||
exchange.getAttributes().put(URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriVariables);
|
||||
exchange.getAttributes().put(MATRIX_VARIABLES_ATTRIBUTE, matrixVariables);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user