Zipkin OpenTracing Brave

Zipkin OpenTracing Brave bridge

License

License

GroupId

GroupId

io.opentracing.brave
ArtifactId

ArtifactId

brave-opentracing
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Zipkin OpenTracing Brave
Zipkin OpenTracing Brave bridge
Project Organization

Project Organization

OpenZipkin
Source Code Management

Source Code Management

https://github.com/openzipkin-contrib/brave-opentracing

Download brave-opentracing

How to add to project

<!-- https://jarcasting.com/artifacts/io.opentracing.brave/brave-opentracing/ -->
<dependency>
    <groupId>io.opentracing.brave</groupId>
    <artifactId>brave-opentracing</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.opentracing.brave/brave-opentracing/
implementation 'io.opentracing.brave:brave-opentracing:1.0.0'
// https://jarcasting.com/artifacts/io.opentracing.brave/brave-opentracing/
implementation ("io.opentracing.brave:brave-opentracing:1.0.0")
'io.opentracing.brave:brave-opentracing:jar:1.0.0'
<dependency org="io.opentracing.brave" name="brave-opentracing" rev="1.0.0">
  <artifact name="brave-opentracing" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.opentracing.brave', module='brave-opentracing', version='1.0.0')
)
libraryDependencies += "io.opentracing.brave" % "brave-opentracing" % "1.0.0"
[io.opentracing.brave/brave-opentracing "1.0.0"]

Dependencies

compile (2)

Group / Artifact Type Version
io.opentracing : opentracing-api jar 0.32.0
io.zipkin.brave : brave jar 5.13.3

test (5)

Group / Artifact Type Version
junit : junit jar 4.13.1
io.zipkin.brave : brave-tests jar 5.13.3
org.mockito : mockito-core jar 3.6.28
org.assertj : assertj-core jar 3.18.1
com.tngtech.junit.dataprovider : junit4-dataprovider jar 2.6

Project Modules

There are no modules declared in this project.

OpenTracing Java Bridge for Zipkin

Gitter chat Build Status Maven Central

This library is a Java bridge between the Brave/Zipkin Api and OpenTracing. It allows its users to write portable (in the OpenTracing sense) instrumentation that's translated into Brave instrumentation transparently.

Compatibility

opentracing-api has broken compatibility on most releases, which limits the ability for this project to provide a large version range.

Here are the versions currently available, noting only the latest version of opentracing-api is likely to have new work in this repository.

Version opentracing-api version
0.34.0+ 0.32.0, 0.33.0
0.33.13 0.31.0

Required Reading

In order to understand OpenTracing Api, one must first be familiar with the OpenTracing project and terminology more generally.

To understand how Zipkin and Brave work, you can look at Zipkin Architecture and Brave Api documentation.

Setup

Firstly, you need a Tracer, configured to report to Zipkin.

// Configure a reporter, which controls how often spans are sent
//   (the dependency is io.zipkin.reporter2:zipkin-sender-okhttp3)
sender = OkHttpSender.create("http://127.0.0.1:9411/api/v2/spans");
spanReporter = AsyncReporter.create(sender);

// If you want to support baggage, create a field you would like to
// propagate and configure it with `BaggagePropagation`
COUNTRY_CODE = BaggageField.create("country-code");

// Baggage does not need to be sent remotely via headers, but if you configure
// with `addRemoteField()`, it will be
propagationFactory = BaggagePropagation.newFactoryBuilder(B3Propagation.FACTORY)
                                       .addRemoteField(COUNTRY_CODE)
                                       .build()

// Now, create a Brave tracing component with the service name you want to see in Zipkin.
//   (the dependency is io.zipkin.brave:brave)
braveTracing = Tracing.newBuilder()
                      .localServiceName("my-service")
                      .propagationFactory(propagationFactory)
                      .spanReporter(spanReporter)
                      .build();

// use this to create an OpenTracing Tracer
tracer = BraveTracer.create(braveTracing);
countryCode = span.getBaggageItem(COUNTRY_CODE.name());

// You can later unwrap the underlying Brave Api as needed
braveTracing = tracer.unwrap();
countryCode = COUNTRY_CODE.get(span.unwrap().context());

Note: If you haven't updated to a server running the Zipkin v2 api, you can use the old Zipkin format like this:

sender = OkHttpSender.json("http://127.0.0.1:9411/api/v1/spans");
spanReporter = AsyncReporter.builder(sender).build(SpanEncoder.JSON_V1);

Artifacts

The artifact published is brave-opentracing under the group ID io.opentracing.brave

Library Releases

Releases are at Sonatype and Maven Central

Library Snapshots

Snapshots are uploaded to Sonatype after commits to master.

io.opentracing.brave

Versions

Version
1.0.0
0.37.5
0.37.4
0.37.2
0.37.1
0.37.0
0.36.2
0.36.1
0.36.0
0.35.1
0.35.0
0.34.2
0.34.1
0.34.0
0.33.13
0.33.12
0.33.11
0.33.10
0.33.9
0.33.8
0.33.7
0.33.6
0.33.5
0.33.4
0.33.3
0.33.2
0.33.1
0.33.0
0.32.1
0.32.0
0.31.3
0.31.2
0.31.1
0.31.0
0.30.5
0.30.4
0.30.3
0.30.2
0.30.1
0.30.0
0.29.0
0.28.0
0.27.0
0.26.0
0.25.0
0.24.0
0.23.0
0.22.1
0.22.0
0.21.1
0.21.0
0.20.0
0.19.3
0.19.2
0.19.1
0.19.0
0.18.3
0.18.2
0.18.1
0.18.0
0.17.0
0.16.0
0.15.0