- Technology stack: Java 8+, OpenTracing, Servlet
- Status: Under development and used in production
TracingFilter filter = new TracingFilter(
tracer, singletonList(new StandardSpanDecorator()), null);
servletContext.addFilter("tracingFilter", filter);
- applies Zalando's standard tags/logs to each request
- builds on top of an existing instrumentation (see dependencies)
- Java 8 or higher
- OpenTracing
- OpenTracing Java Web Servlet Filter Instrumentation
Add the following dependency to your project:
<dependency>
<groupId>org.zalando</groupId>
<artifactId>opentracing-servlet-extension</artifactId>
<version>${opentracing-servlet-extension.version}</version>
</dependency>
A new span will be started for each request/response.
The following tags/logs are supported out of the box:
Tag/Log Field | Decorator | Example |
---|---|---|
component |
ComponentSpanDecorator |
Servlet |
http.method_override |
HttpMethodSpanDecorator |
GET |
http.method |
HttpMethodSpanDecorator |
POST |
http.prefer |
HttpPreferSpanDecorator |
respond=async |
http.retry_after |
HttpRetryAfterSpanDecorator |
60 |
http.status_code |
HttpStatusCodeSpanDecorator |
200 |
http.url ¹ |
HttpUrlSpanDecorator |
http://localhost/users?q=me |
peer.address |
PeerAddressSpanDecorator |
localhost:80 |
peer.hostname |
PeerSpanDecorator |
localhost |
peer.ipv4 |
PeerSpanDecorator |
127.0.0.1 |
peer.ipv6 |
PeerSpanDecorator |
::1 |
peer.port |
PeerSpanDecorator |
80 |
error |
ErrorSpanDecorator |
true |
error.kind (log) |
ErrorSpanDecorator |
SocketTimeoutException |
error.object (log) |
ErrorSpanDecorator |
(exception instance) |
message (log) |
ErrorMessageSpanDecorator |
Connection timed out |
stack (log) |
ErrorStackSpanDecorator |
SocketTimeoutException at [...] |
¹ Disabled by default due to security concerns (may expose passwords)
Custom SpanDecorator
implementations that are registered using Java's Service Provider Interface mechanism will be picked up automatically by default.
If you have questions, concerns, bug reports, etc., please file an issue in this repository's Issue Tracker.
To contribute, simply make a pull request and add a brief description (1-2 sentences) of your addition or change. For more details, check the contribution guidelines.