From ffd154d41d5c593f9f06b06fca738235280fc9b8 Mon Sep 17 00:00:00 2001 From: JACQUES Francois Date: Sun, 5 Jan 2020 12:13:28 +0100 Subject: [PATCH] Fixes #135 : add ContainerRequestContext to decorateResponse arguments. --- .../contrib/jaxrs2/server/ServerSpanDecorator.java | 5 +++-- .../contrib/jaxrs2/server/ServerTracingFilter.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/opentracing-jaxrs2/src/main/java/io/opentracing/contrib/jaxrs2/server/ServerSpanDecorator.java b/opentracing-jaxrs2/src/main/java/io/opentracing/contrib/jaxrs2/server/ServerSpanDecorator.java index b665520..2ea25b6 100644 --- a/opentracing-jaxrs2/src/main/java/io/opentracing/contrib/jaxrs2/server/ServerSpanDecorator.java +++ b/opentracing-jaxrs2/src/main/java/io/opentracing/contrib/jaxrs2/server/ServerSpanDecorator.java @@ -22,10 +22,11 @@ public interface ServerSpanDecorator { /** * Decorate spans by outgoing object. * + * @param requestContext * @param responseContext * @param span */ - void decorateResponse(ContainerResponseContext responseContext, Span span); + void decorateResponse(ContainerRequestContext requestContext, ContainerResponseContext responseContext, Span span); /** * Adds standard tags: {@link io.opentracing.tag.Tags#SPAN_KIND}, @@ -45,7 +46,7 @@ public void decorateRequest(ContainerRequestContext requestContext, Span span) { } @Override - public void decorateResponse(ContainerResponseContext responseContext, Span span) { + public void decorateResponse(ContainerRequestContext requestContext, ContainerResponseContext responseContext, Span span) { Tags.HTTP_STATUS.set(span, responseContext.getStatus()); } }; diff --git a/opentracing-jaxrs2/src/main/java/io/opentracing/contrib/jaxrs2/server/ServerTracingFilter.java b/opentracing-jaxrs2/src/main/java/io/opentracing/contrib/jaxrs2/server/ServerTracingFilter.java index 768f15a..33031c7 100644 --- a/opentracing-jaxrs2/src/main/java/io/opentracing/contrib/jaxrs2/server/ServerTracingFilter.java +++ b/opentracing-jaxrs2/src/main/java/io/opentracing/contrib/jaxrs2/server/ServerTracingFilter.java @@ -121,7 +121,7 @@ public void filter(ContainerRequestContext requestContext, if (spanDecorators != null) { for (ServerSpanDecorator decorator: spanDecorators) { - decorator.decorateResponse(responseContext, spanWrapper.get()); + decorator.decorateResponse(requestContext, responseContext, spanWrapper.get()); } } }