Coder Social home page Coder Social logo

dropwizard-zipkin's Introduction

Dropwizard Zipkin Bundle

Build Status Maven Central GitHub license Become a Patron

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>2.0.7-1</version>
</dependency>

Beginning with v1.2.2-4, if you are using the Kafka sender, you must explicitly add the kafka-clients dependency into your pom.xml as it has been excluded from the zipkin-core module.

<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka-clients</artifactId>
    <version>2.2.1</version>
</dependency>

Usage

Add a ZipkinBundle to your Application class.

private ZipkinBundle<HelloWorldConfiguration> zipkinBundle;

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

@Override
public void run(HelloWorldConfiguration configuration, Environment environment) throws Exception {
  final Optional<HttpTracing> tracing = zipkinBundle.getHttpTracing();
}

Configuration

For configuring the Zipkin connection, there is a ZipkinFactory:

zipkin:

  # Required properties
  # Whether tracing is enabled or not (defaults to true)
  enabled: true
  # Listening IP address of the service
  serviceHost: 192.168.1.100
  # Listening port of the service
  servicePort: 8080

  # Optional properties
  # Span collector to use (console, http, kafka or empty)
  collector: http
  # If using the http collector, provide the baseUrl
  baseUrl: http://127.0.0.1:9411/
  # If using the http collector, timeout out when connecting (defaults to 10s)
  connectTimeout: 10s
  # If using the http collector, timeout out when reading the response (defaults to 60s)
  readTimeout: 60s
  # 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.

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

./mvnw clean package
java -jar zipkin-example/target/zipkin-example-*-SNAPSHOT.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 an 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) 2020 Smoke Turner, LLC

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.

dropwizard-zipkin's People

Contributors

adriancole avatar dennyac avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar jplock avatar pavolloffay avatar reftel avatar rieske avatar spikhalskiy avatar spudone avatar xihw avatar ygaller avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.