Report HTTP pattern and handler function name for functional WebFlux routes. (#1513)

This commit is contained in:
Csaba Kos
2020-01-07 10:07:28 -06:00
committed by Marcin Grzejszczak
parent 06cb4d747d
commit 68f720a2e5
2 changed files with 38 additions and 12 deletions

View File

@@ -278,17 +278,13 @@ public final class TraceWebFilter implements WebFilter, Ordered {
}
private void terminateSpan(@Nullable Throwable t) {
String httpRoute = null;
Object attribute = this.exchange
.getAttribute(HandlerMapping.BEST_MATCHING_HANDLER_ATTRIBUTE);
if (attribute instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) attribute;
addClassMethodTag(handlerMethod, this.span);
addClassNameTag(handlerMethod, this.span);
Object pattern = this.exchange
.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
httpRoute = pattern != null ? pattern.toString() : "";
}
addClassMethodTag(attribute, this.span);
addClassNameTag(attribute, this.span);
Object pattern = this.exchange
.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
String httpRoute = pattern != null ? pattern.toString() : "";
addResponseTagsForSpanWithoutParent(this.exchange,
this.exchange.getResponse(), this.span);
DecoratedServerHttpResponse delegate = new DecoratedServerHttpResponse(