Skip to content
Permalink
Browse files
adding component tag
  • Loading branch information
rmannibucau committed May 20, 2018
1 parent 231b504 commit cb6a989e319048d3f53b636ce9f4031e3ff0a261
Showing 3 changed files with 4 additions and 1 deletion.
@@ -49,6 +49,7 @@ public void filter(final ClientRequestContext context) {

final Tracer.SpanBuilder builder = tracer.buildSpan(context.getMethod());
builder.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT);
builder.withTag("component", "jaxrs");

ofNullable(SpanContext.class.cast(context.getProperty(CHILD_OF)))
.ifPresent(parent -> builder.ignoreActiveSpan().asChildOf(parent));
@@ -23,7 +23,7 @@
import io.opentracing.tag.Tags;

@Dependent
@WebFilter(asyncSupported = true, urlPatterns = "/*")
@WebFilter(asyncSupported = true, urlPatterns = "/*") // todo: move to initializer
public class OpenTracingFilter implements Filter {

@Inject
@@ -36,6 +36,7 @@ public void doFilter(final ServletRequest request, final ServletResponse respons
chain.doFilter(request, response);
return;
}
// todo: implicit start for matching urls
try {
chain.doFilter(request, response);
} catch (final Exception ex) {
@@ -49,6 +49,7 @@ public void filter(final ContainerRequestContext context) {

final Tracer.SpanBuilder builder = tracer.buildSpan(operationName);
builder.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_SERVER);
builder.withTag("component", "jaxrs");

ofNullable(ofNullable(tracer.activeSpan()).map(Span::context)
.orElseGet(() -> tracer.extract(Format.Builtin.HTTP_HEADERS, new HeaderTextMap<>(context.getHeaders()))))

0 comments on commit cb6a989

Please sign in to comment.