desperado1992 / dropwizard-zipkin

Dropwizard Zipkin Bundle

Home Page:http://smoketurner.github.io/dropwizard-zipkin/1.0.2-3/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dropwizard Zipkin Bundle

Build Status Coverage Status Maven Central GitHub license

A bundle for submitting tracing data to Zipkin from Dropwizard applications. Internally, this library uses Brave to interface a Zipkin collector.

Dependency Info

<dependency>
    <groupId>com.smoketurner.dropwizard</groupId>
    <artifactId>zipkin-core</artifactId>
    <version>1.0.2-3</version>
</dependency>

Usage

Add a ZipkinBundle to your Application class.

@Override
public void initialize(Bootstrap<MyConfiguration> bootstrap) {
    // ...
    bootstrap.addBundle(new ZipkinBundle<MyConfiguration>(getName()) {
        @Override
        public ZipkinFactory getZipkinFactory(MyConfiguration configuration) {
            return configuration.getZipkinFactory();
        }
    });
}

@Override
public void run(MyConfiguration configuration, Environment environment) throws Exception {
    Brave brave = configuration.getZipkinFactory().build(environment);
}

Configuration

For configuring the Zipkin connection, there is a ZipkinFactory:

zipkin:

  # Required properties
  # Listening IP address of the service
  serviceHost: 192.168.1.100
  # Listening port of the service
  servicePort: 8080

  # Optional properties
  # Span collector to use (scribe, logging, http, kafka or empty)
  collector: http
  # If using the scribe collector, provide the endpoint
  endpoint: 127.0.0.1:9411
  # If using the http collector, provide the baseUrl
  baseUrl: http://127.0.0.1:9411/
  # If using the kafka collector, provide the Kafka bootstrap servers
  bootstrapServers: 127.0.0.1:9092;10.0.1.1:9092

Example Application

This bundle includes a modified version of the HelloWorldApplication from Dropwizard's Getting Started documentation.

<dependency>
    <groupId>com.smoketurner.dropwizard</groupId>
    <artifactId>zipkin-example</artifactId>
    <version>1.0.2-3</version>
</dependency>

You can execute this application by first starting Zipkin on your local machine then running:

mvn clean package
java -jar zipkin-example/target/zipkin-example-1.0.2-3.jar server zipkin-example/hello-world.yml

This will start the application on port 8080 (admin port 8180). This application demonstrations the following Zipkin integration points:

  • You can use the included ZipkinClientBuilder to construct instrumented JerseyClient's that will send span traces to Zipkin
  • The service will send request and response traces to Zipkin

Support

Please file bug reports and feature requests in GitHub issues.

License

Copyright (c) 2016 Justin Plock

This library is licensed under the Apache License, Version 2.0.

See http://www.apache.org/licenses/LICENSE-2.0.html or the LICENSE file in this repository for the full license text.

About

Dropwizard Zipkin Bundle

http://smoketurner.github.io/dropwizard-zipkin/1.0.2-3/

License:Apache License 2.0


Languages

Language:Java 98.9%Language:Shell 1.1%