GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - service-enabled/dropwizard-request-tracker: Track service requests through multiple hops using a UUID

BranchesTags
Open more actions menu

Latest commit

 

History

73 Commits
73 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

Repository files navigation

dropwizard-request-tracker

Track service requests through multiple hops using a UUID.

Build Status

Description

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.

Compatibility

Version Dropwizard Version
2.0.x 1.2.x, 1.1.x, 1.0.x, 0.9.x
0.2.x 0.8.x, 0.7.x

Integrating with existing dropwizard project

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

Defaults

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";
	}
}

License

MIT

About

Track service requests through multiple hops using a UUID

Topics

dropwizardjavarequest-tracker

Resources

Readme
MIT license
Activity
Custom properties

Stars

29 stars

Watchers

6 watching

Forks

20 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.