jaegertracing/jaeger-client-java

Name: jaeger-client-java

Owner: Jaeger - Distributed Tracing System

Description: Jaeger Bindings for Java OpenTracing API

Created: 2016-04-19 00:10:02.0

Updated: 2018-05-24 14:50:28.0

Pushed: 2018-05-24 14:50:26.0

Homepage: https://jaegertracing.io/

Size: 1492

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build Status Coverage Status Released Version FOSSA Status

Jaeger's Tracing Instrumentation Library for Java

Package rename to io.jaegertracing

Groupid com.uber.jaeger has been deprecated and moved to a different repository. Please switch to io.jaegertracing. Old groupid will be maintained only for bug fixes.

Contributing and Developing

Please see CONTRIBUTING.md.

Core Modules

Click through for more detailed docs on specific modules.

Add-on Modules
Importing Dependencies

All artifacts are published to Maven Central. Snapshot artifacts are also published to Sonatype. Follow these instructions to add the snapshot repository to your build system.

Add the required dependencies to your project. Usually, this would only be the add-ons you require. Please use the latest version: Released Version

For e.g, to depend on the core jaeger library, you'd include the following

endency>
<groupId>io.jaegertracing</groupId>
<artifactId>jaeger-core</artifactId>
<version>$jaegerVersion</version>
pendency>
Thrift version conflicts

Jaeger client uses org.apache.thrift:libthrift:0.9.2. If your project depends on a different version of libthrift, it is recommended that you use the shaded jaeger-thrift jar we publish which packages it's own libthrift.

To depend on the shaded jar, add the following to your maven build. Note that this is only supported for a jaeger version >= 0.15.0

endencyManagement>
ependencies>
<dependency>
  <groupId>io.jaegertracing</groupId>
  <artifactId>jaeger-thrift</artifactId>
  <classifier>thrift92</classifier>
  <version>$jaegerVersion</version>
</dependency>
dependencies>
pendencyManagement>
Instantiating the Tracer

Please see jaeger-core/README.

Testing

When testing tracing instrumentation it is often useful to make sure that all spans are being captured, which is not the case in production configurations where heavy sampling is applied by default. The following configuration can be provided to affect which sampling is applied to the new traces:

ler:
ype: const # can either be const, probabilistic, or ratelimiting
aram: 1  # can either be an integer, a double, or an integer

The valid values for type are:

Debug Traces (Forced Sampling)
Programmatically

The OpenTracing API defines a sampling.priority standard tag that can be used to affect the sampling of a span and its children:

rt io.opentracing.tag.Tags;

.SAMPLING_PRIORITY.set(span, 1);
Via HTTP Headers

Jaeger Tracer also understands a special HTTP Header jaeger-debug-id, which can be set in the incoming request, e.g.

 -H "jaeger-debug-id: some-correlation-id" http://myhost.com

When Jaeger sees this header in the request that otherwise has no tracing context, it ensures that the new trace started for this request will be sampled in the “debug” mode (meaning it should survive all downsampling that might happen in the collection pipeline), and the root span will have a tag as if this statement was executed:

.setTag("jaeger-debug-id", "some-correlation-id")

This allows using Jaeger UI to find the trace by this tag.

License

Apache 2.0 License.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.