
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
com.serviceenabled:dropwizard-request-tracker
Advanced tools
Track service requests through multiple hops using a UUID
Track service requests through multiple hops using a UUID.
This project uses servlet filters, Jersey client filters, and Logback's MDC to keep track of an ID through multiple hops. The servlet and client filters will intercept a request and automatically generate an ID if none exists. The client filter adds the ID as a request header. The servlet filter intercepts the ID.
There's a Dropwizard bundle that will add in the servlet filter for you. Jersey client filters have to be manually added to your client classes.
Add the following dependency into your pom.xml
<dependency>
<groupId>com.serviceenabled</groupId>
<artifactId>dropwizard-request-tracker</artifactId>
<version>0.2.0</version>
</dependency>
Add RequestTrackerConfiguration into your application's configuration class.
public class ExampleConfiguration extends Configuration {
private RequestTrackerConfiguration requestTrackerConfiguration = new RequestTrackerConfiguration();
public RequestTrackerConfiguration getRequestTrackerConfiguration() {
return requestTrackerConfiguration;
}
public void setRequestTrackerConfiguration(RequestTrackerConfiguration configuration) {
this.requestTrackerConfiguration = configuration;
}
}
Add the RequestTrackerBundle to your application
bootstrap.addBundle(new RequestTrackerBundle<ExampleConfiguration>() {
@Override
public RequestTrackerConfiguration getRequestTrackerConfiguration(BundleConfiguration configuration) {
return configuration.getRequestTrackerConfiguration();
}
});
Add the client filter to your client classes
client.addFilter(new RequestTrackerClientFilter(configuration.getRequestTrackerConfiguration()));
If you'd like the ID to be output in your logs, add %X{Request-Tracker} to your logFormat.
and mvn clean install
The RequestTrackerConfiguration sets the HTTP header name to X-Request-Tracker and the MDC key to Request-Tracker by default. These can be overridden in your YAML configuration.
By default UuidSupplier is used by the bundle and filters. The provided bundle and filters provide constructors for you to pass in your own custom ID supplier. Your custom ID supplier must implement Guava's Supplier<String>. Here's an example ID supplier:
import com.google.common.base.Supplier;
public class CustomIdSupplier implements Supplier<String> {
@Override
public String get() {
return "12345";
}
}
FAQs
Track service requests through multiple hops using a UUID
We found that com.serviceenabled:dropwizard-request-tracker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.