com.github.dikhan.dropwizard.TraceHeadersApplication Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dropwizard-header-metric Show documentation
Show all versions of dropwizard-header-metric Show documentation
Create metrics and send it to the preferable reporter if request header matches any of the headers
configured to be measured.
The newest version!
package com.github.dikhan.dropwizard;
import com.github.dikhan.dropwizard.headermetric.TraceHeadersBundle;
import com.github.dikhan.dropwizard.headermetric.TraceHeadersBundleConfiguration;
import com.github.dikhan.dropwizard.headermetric.resources.HelloWorldResource;
import io.dropwizard.Application;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
public class TraceHeadersApplication extends Application {
public static void main(String[] args) throws Exception {
new TraceHeadersApplication().run(args);
}
@Override
public String getName() {
return "header-metric-application";
}
@Override
public void initialize(Bootstrap bootstrap) {
bootstrap.addBundle(new TraceHeadersBundle(bootstrap.getMetricRegistry()) {
@Override
protected TraceHeadersBundleConfiguration getTraceHeadersBundleConfiguration(TraceHeadersApplicationConfiguration configuration) {
return configuration.getTraceHeadersBundleConfiguration();
}
});
}
@Override
public void run(TraceHeadersApplicationConfiguration configuration, Environment environment) throws Exception {
environment.jersey().register(new HelloWorldResource());
}
}