All Projects → lightstep → lightstep-tracer-java

lightstep / lightstep-tracer-java

Licence: MIT license
The Lightstep distributed tracing library for JRE

Programming Languages

java
68154 projects - #9 most used programming language
shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to lightstep-tracer-java

Dd Trace Php
Datadog Tracing PHP Client
Stars: ✭ 203 (+341.3%)
Mutual labels:  opentracing
haystack-docker
Repository with docker-compose files to start Haystack components in sandbox
Stars: ✭ 17 (-63.04%)
Mutual labels:  opentracing
go-gin-logrus
Gin Web Framework for using Logrus as the Gin logger with Tracing middleware
Stars: ✭ 38 (-17.39%)
Mutual labels:  opentracing
Natchez
functional tracing for cats
Stars: ✭ 214 (+365.22%)
Mutual labels:  opentracing
Dd Trace Go
A Go tracing package for Datadog APM
Stars: ✭ 244 (+430.43%)
Mutual labels:  opentracing
Petabridge.Tracing.ApplicationInsights
OpenTracing adapter for Microsoft Application Insights
Stars: ✭ 30 (-34.78%)
Mutual labels:  opentracing
Mastering Distributed Tracing
"Mastering Distributed Tracing" by Yuri Shkuro, published by Packt
Stars: ✭ 189 (+310.87%)
Mutual labels:  opentracing
java-grpc
OpenTracing Instrumentation for gRPC
Stars: ✭ 52 (+13.04%)
Mutual labels:  opentracing
java-concurrent
OpenTracing-aware helpers related to java.util.concurrent
Stars: ✭ 36 (-21.74%)
Mutual labels:  opentracing
otters
Support for OpenTracing in Erlang
Stars: ✭ 31 (-32.61%)
Mutual labels:  opentracing
Csharp Netcore
OpenTracing instrumentation for .NET Core & .NET 5 apps
Stars: ✭ 225 (+389.13%)
Mutual labels:  opentracing
Instrumentedsql
A sql driver that will wrap any other driver and log/trace all its calls
Stars: ✭ 244 (+430.43%)
Mutual labels:  opentracing
opentracing-gorm
OpenTracing instrumentation for GORM.
Stars: ✭ 46 (+0%)
Mutual labels:  opentracing
Dd Trace Js
JavaScript APM Tracer
Stars: ✭ 212 (+360.87%)
Mutual labels:  opentracing
nodejs
Node.js in-process collectors for Instana
Stars: ✭ 66 (+43.48%)
Mutual labels:  opentracing
Kanali
A Kubernetes Native API Management Solution
Stars: ✭ 192 (+317.39%)
Mutual labels:  opentracing
datadog-tracer-js
[DEPRECATED] OpenTracing tracer implementation for Datadog in JavaScript.
Stars: ✭ 39 (-15.22%)
Mutual labels:  opentracing
microservices-demo
A Monorepo Demoing Microservices Architecture
Stars: ✭ 36 (-21.74%)
Mutual labels:  opentracing
dd-go-opentracing
[WIP] OpenTracing Tracer implementation for Datadog in Go
Stars: ✭ 22 (-52.17%)
Mutual labels:  opentracing
python-flask
OpenTracing instrumentation for the Flask microframework
Stars: ✭ 133 (+189.13%)
Mutual labels:  opentracing

lightstep-tracer-java

Download Circle CI MIT license

The LightStep distributed tracing library for the standard Java runtime environment.

Getting started: JRE

The JRE library is hosted on Maven Central.

Note: Starting from version 0.30.0, lightstep-tracer-java-common and lightstep-tracer-java artifacts use the same major/minor version, only differing in the patch part.

Maven

<dependency>
    <groupId>com.lightstep.tracer</groupId>
    <artifactId>lightstep-tracer-jre</artifactId>
    <version> VERSION </version>
</dependency>
<dependency>
   <groupId>com.lightstep.tracer</groupId>
   <artifactId>tracer-okhttp</artifactId>
   <version> VERSION </version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.7.25</version>
</dependency>
  • Be sure to replace VERSION with the current version of the library. For TRACER-GRPC-VERSION you can refer to lightstep-tracer-common which contains tracer-grpc (and tracer-okhttp).
  • LightStep libraries use provided scope for grpc-netty, netty-tcnative-boringssl-static and slf4j. In other words, LightStep tracer libraries will rely on whichever gRPC/Netty/sl4j version is currently available (i.e. pulled in at runtime) to avoid conflicting with existing versions within your project

Gradle

In most cases, modifying your build.gradle with the below is all that is required:

repositories {
    mavenCentral() // OR jcenter()
}
dependencies {
    compile 'com.lightstep.tracer:lightstep-tracer-jre:VERSION'
    compile 'com.lightstep.tracer:tracer-okhttp:VERSION'
    compile 'org.slf4j:slf4j-simple:1.7.25'
}
  • Be sure to replace VERSION with the current version of the library
  • The artifact is published to both jcenter() and mavenCentral(). Use whichever you prefer.

Initializing the LightStep Tracer

// Important the OpenTracing interfaces
import io.opentracing.Span;
import io.opentracing.Tracer;

// ...

// Initialize the OpenTracing Tracer with LightStep's implementation
Tracer tracer = new com.lightstep.tracer.jre.JRETracer(
         new com.lightstep.tracer.shared.Options.OptionsBuilder()
            .withAccessToken("{your_access_token}")
            .build()
);

// Start and finish a Span
Span span = tracer.buildSpan("my_span").start();
this.doSomeWorkHere();
span.finish();

API Documentation

Tracing instrumentation should use the OpenTracing APIs to stay portable and in sync with the standard:

For reference, the generated LightStep documentation is also available:

Options

Setting a custom component name

To set the name used in the LightStep UI for this instance of the Tracer, call withComponentName() on the OptionsBuilder object:

options = new com.lightstep.tracer.shared.Options.OptionsBuilder()
                      .withAccessToken("{your_access_token}")
                      .withComponentName("your_custom_name")
                      .build();

Disabling the reporting loop

By default, the Java library does a report of any buffered data on a fairly regular interval. To disable this behavior and rely only on explicit calls to flush() to report data, initialize with:

options = new com.lightstep.tracer.shared.Options.OptionsBuilder()
                      .withAccessToken("{your_access_token}")
                      .withDisableReportingLoop(true)
                      .build();

To then manually flush by using the LightStep tracer object directly:

// Flush any buffered tracing data
((com.lightstep.tracer.jre.JRETracer)tracer).flush();

Flushing the report at exit

In order to send a final flush of the data prior to exit, clients should manually flush by using the LightStep tracer object as described above.

Disabling default clock correction

By default, the Java library performs clock correction based on timestamp information provided in the spans. To disable this behavior, initialize with:

options = new com.lightstep.tracer.shared.Options.OptionsBuilder()
                      .withAccessToken("{your_access_token}")
                      .withClockSkewCorrection(false)
                      .build();

Advanced Option: Transport and Serialization Protocols

By following the above configuration, the tracer will send information to LightStep using HTTP and Protocol Buffers which is the recommended configuration. If there are no specific transport protocol needs you have, there is no need to change this default.

There are two options for transport protocols:

  • Protocol Buffers over HTTP using OkHttp - The recommended and default solution.
  • Protocol Buffers over GRPC - This is a more advanced solution that might be desirable if you already have gRPC networking configured.

You can configure the tracer to support gRPC by replacing com.lightstep.tracer:tracer-okhttp with com.lightstep.tracer:tracer-grpc when including the tracer dependency and including a grpc dependency. i.e.

Maven

<dependency>
  <groupId>com.lightstep.tracer</groupId>
  <artifactId>lightstep-tracer-jre</artifactId>
  <version> VERSION </version>
</dependency>
<dependency>
   <groupId>com.lightstep.tracer</groupId>
   <artifactId>tracer-grpc</artifactId>
   <version> VERSION </version>
</dependency>
<dependency>
    <groupId>io.grpc</groupId>
    <artifactId>grpc-netty</artifactId>
    <version>1.23.0</version>
</dependency>
<dependency>
    <groupId>io.netty</groupId>
    <artifactId>netty-tcnative-boringssl-static</artifactId>
    <version>2.0.25.Final</version>
</dependency>

Gradle

repositories {
    mavenCentral() // OR jcenter()
}
dependencies {
    compile 'com.lightstep.tracer:lightstep-tracer-jre:VERSION'
    compile 'com.lightstep.tracer:tracer-grpc:VERSION'
    compile 'io.grpc:grpc-netty:1.23.0'
    compile 'io.netty:netty-tcnative-boringssl-static:2.0.25.Final'
}

Development info

See DEV.md for information on contributing to this instrumentation library.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].