<commit_before>Dropwizard Zipkin Bundle
========================
[![Build Status](https://travis-ci.org/smoketurner/dropwizard-zipkin.svg?branch=master)](https://travis-ci.org/smoketurner/dropwizard-zipkin)
[![Coverage Status](https://coveralls.io/repos/smoketurner/dropwizard-zipkin/badge.svg)](https://coveralls.io/r/smoketurner/dropwizard-zipkin)
[![Maven Central](https://img.shields.io/maven-central/v/com.smoketurner.dropwizard/dropwizard-zipkin.svg?style=flat-square)](https://maven-badges.herokuapp.com/maven-central/com.smoketurner.dropwizard/dropwizard-zipkin/)
[![GitHub license](https://img.shields.io/github/license/smoketurner/dropwizard-zipkin.svg?style=flat-square)](https://github.com/smoketurner/dropwizard-zipkin/tree/master)

A bundle for submitting tracing data to [Zipkin](http://zipkin.io) from Dropwizard applications. Internally, this library uses [Brave](https://github.com/openzipkin/brave) to interface a Zipkin collector.

Dependency Info
---------------
```xml
<dependency>
    <groupId>com.smoketurner.dropwizard</groupId>
    <artifactId>zipkin-core</artifactId>
    <version>1.2.2-3</version>
</dependency>
```

Usage
-----
Add a `ZipkinBundle` to your [Application](http://www.dropwizard.io/1.2.2/dropwizard-core/apidocs/io/dropwizard/Application.html) class.

```java
@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 {
    Optional<Brave> brave = configuration.getZipkinFactory().build(environment);
}
```

Configuration
-------------
For configuring the Zipkin connection, there is a `ZipkinFactory`:

```yaml
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 kafka collector, provide the Kafka bootstrap servers
  bootstrapServers: 127.0.0.1:9092;10.0.1.1:9092
```

Example Application<commit_msg>Fix example (fixes #30)<commit_after>Dropwizard Zipkin Bundle
========================
[![Build Status](https://travis-ci.org/smoketurner/dropwizard-zipkin.svg?branch=master)](https://travis-ci.org/smoketurner/dropwizard-zipkin)
[![Coverage Status](https://coveralls.io/repos/smoketurner/dropwizard-zipkin/badge.svg)](https://coveralls.io/r/smoketurner/dropwizard-zipkin)
[![Maven Central](https://img.shields.io/maven-central/v/com.smoketurner.dropwizard/dropwizard-zipkin.svg?style=flat-square)](https://maven-badges.herokuapp.com/maven-central/com.smoketurner.dropwizard/dropwizard-zipkin/)
[![GitHub license](https://img.shields.io/github/license/smoketurner/dropwizard-zipkin.svg?style=flat-square)](https://github.com/smoketurner/dropwizard-zipkin/tree/master)

A bundle for submitting tracing data to [Zipkin](http://zipkin.io) from Dropwizard applications. Internally, this library uses [Brave](https://github.com/openzipkin/brave) to interface a Zipkin collector.

Dependency Info
---------------
```xml
<dependency>
    <groupId>com.smoketurner.dropwizard</groupId>
    <artifactId>zipkin-core</artifactId>
    <version>1.2.2-3</version>
</dependency>
```

Usage
-----
Add a `ZipkinBundle` to your [Application](http://www.dropwizard.io/1.2.2/dropwizard-core/apidocs/io/dropwizard/Application.html) class.

```java
@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 {
    Optional<HttpTracing> tracing = configuration.getZipkinFactory().build(environment);
}
```

Configuration
-------------
For configuring the Zipkin connection, there is a `ZipkinFactory`:

```yaml
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 kafka collector, provide the Kafka bootstrap servers
  bootstrapServers: 127.0.0.1:9092;10.0.1.1:9092
```

Example Application
{'fraction_non_alphanumeric': 0.14842189372752695, 'fraction_numerical': 0.02037554934079105, 'mean_word_length': 4.5633333333333335, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 18, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4950533', 'n_tokens_mistral': 1700, 'n_tokens_neox': 1567, 'n_words': 306}