All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dikhan.dropwizard.TraceHeadersApplication Maven / Gradle / Ivy

Go to download

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());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy