io.opentracing.contrib:opentracing-web-servlet-filter

Support for integrating OpenTracing in Web Servlet projects

License

License

GroupId

GroupId

io.opentracing.contrib
ArtifactId

ArtifactId

opentracing-web-servlet-filter
Last Version

Last Version

0.4.1
Release Date

Release Date

Type

Type

jar
Description

Description

Support for integrating OpenTracing in Web Servlet projects

Download opentracing-web-servlet-filter

How to add to project

<!-- https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-web-servlet-filter/ -->
<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-web-servlet-filter</artifactId>
    <version>0.4.1</version>
</dependency>
// https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-web-servlet-filter/
implementation 'io.opentracing.contrib:opentracing-web-servlet-filter:0.4.1'
// https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-web-servlet-filter/
implementation ("io.opentracing.contrib:opentracing-web-servlet-filter:0.4.1")
'io.opentracing.contrib:opentracing-web-servlet-filter:jar:0.4.1'
<dependency org="io.opentracing.contrib" name="opentracing-web-servlet-filter" rev="0.4.1">
  <artifact name="opentracing-web-servlet-filter" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.opentracing.contrib', module='opentracing-web-servlet-filter', version='0.4.1')
)
libraryDependencies += "io.opentracing.contrib" % "opentracing-web-servlet-filter" % "0.4.1"
[io.opentracing.contrib/opentracing-web-servlet-filter "0.4.1"]

Dependencies

compile (2)

Group / Artifact Type Version
io.opentracing : opentracing-api jar 0.33.0
io.opentracing : opentracing-util jar 0.33.0

provided (1)

Group / Artifact Type Version
javax.servlet : javax.servlet-api jar 3.1.0

test (8)

Group / Artifact Type Version
io.opentracing : opentracing-mock jar 0.33.0
org.awaitility : awaitility jar 3.0.0
org.mockito : mockito-core jar 1.10.19
org.eclipse.jetty : jetty-server jar 9.4.17.v20190418
org.eclipse.jetty : jetty-servlet jar 9.4.17.v20190418
com.squareup.okhttp3 : okhttp jar 3.5.0
junit : junit jar 4.12
org.mockito : mockito-all jar 1.10.19

Project Modules

There are no modules declared in this project.

Build Status Released Version

OpenTracing Java Web Servlet Filter Instrumentation

This library provides instrumentation for Java Web Servlet applications.

Initialization

Tracing filter can be programmatically initialized:

   TracingFilter filter = new TracingFilter(tracer);
   servletContext.addFilter("tracingFilter", filter);

or added to web.xml, however it requires to register a tracer instance: GlobalTracer.register(tracer).

Tracer override

If a tracer has been associated with the ServletContext as an attribute with key io.opentracing.Tracer, then it will override any tracer explicitly passed to the filter or registered with the GlobalTracer.

This approach can be used where OpenTracing and Tracer implementation specific dependencies are configured within a servlet container (rather than bundled with the webapp), and we don't wish to share a single GlobalTracer instance across all webapps (e.g. as this may mean all webapps report their spans associated with the same service name).

In these situations, using a ServletContextListener to create a Tracer will enable it to be specific to the webapp and managed with its lifecycle.

Accessing Server Span

Current server span context is accessible in HttpServletRequest attributes.

   SpanContext spanContext = (SpanContext)httpservletRequest.getAttribute(TracingFilter.SERVER_SPAN_CONTEXT);
   

Development

./mvnw clean install

Release

Follow instructions in RELEASE

io.opentracing.contrib

3rd-Party OpenTracing API Contributions

3rd-party contributions that use OpenTracing. **The repositories in this org are *not* affiliated with the CNCF.**

Versions

Version
0.4.1
0.4.0
0.3.0
0.2.3
0.2.2
0.2.1
0.2.0
0.1.1
0.1.0
0.1.0-RC1
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2