io.opentracing.contrib.web.servlet.filter.HttpServletRequestExtractAdapter Java Examples
The following examples show how to use
io.opentracing.contrib.web.servlet.filter.HttpServletRequestExtractAdapter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TracingFilterUtil.java From java-specialagent with Apache License 2.0 | 5 votes |
public static Span buildSpan(final HttpServletRequest httpRequest, final Tracer tracer, final List<ServletFilterSpanDecorator> spanDecorators) { final SpanContext extractedContext = tracer.extract(Format.Builtin.HTTP_HEADERS, new HttpServletRequestExtractAdapter(httpRequest)); final Span span = tracer.buildSpan(httpRequest.getMethod()) .asChildOf(extractedContext) .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_SERVER) .start(); httpRequest.setAttribute(SERVER_SPAN_CONTEXT, span.context()); for (final ServletFilterSpanDecorator spanDecorator: spanDecorators) spanDecorator.onRequest(httpRequest, span); return span; }
Example #2
Source File: OpenTracingFilter.java From problematic-microservices with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void filter(ContainerRequestContext requestContext) throws IOException { if (!isTraced(requestContext)) { SpanContext extractedContext = tracer.extract(Format.Builtin.HTTP_HEADERS, new HttpServletRequestExtractAdapter(httpRequest)); final Scope scope = tracer.buildSpan(httpRequest.getRequestURL().toString()).asChildOf(extractedContext) .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_SERVER).startActive(false); httpRequest.setAttribute(SERVER_SPAN_SCOPE, scope); httpRequest.setAttribute(SERVER_SPAN_CONTEXT, scope.span().context()); } }
Example #3
Source File: ServerHeadersExtractTextMap.java From java-jaxrs with Apache License 2.0 | 4 votes |
@Override public Iterator<Map.Entry<String, String>> iterator() { return new HttpServletRequestExtractAdapter.MultivaluedMapFlatIterator<>(headers.entrySet()); }