GithubHelp home page GithubHelp logo

etsangsplk / java-web-servlet-filter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from opentracing-contrib/java-web-servlet-filter

0.0 1.0 0.0 154 KB

OpenTracing Java Web Servlet Filter Instrumentation

License: Apache License 2.0

Java 91.14% Shell 8.86%

java-web-servlet-filter's Introduction

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

java-web-servlet-filter's People

Contributors

bensigelman avatar objectiser avatar pavolloffay avatar serceman avatar sjoerdtalsma avatar skabashnyuk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.