Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.18 KB

README.md

File metadata and controls

46 lines (34 loc) · 1.18 KB

opentracing

This module provides support to use OpenTracing API for Java with julian-http-client.

Install

Maven

<dependency>
    <groupId>com.github.ljtfreitas.julian-http-client</groupId>
    <artifactId>julian-http-client-http-opentracing</artifactId>
    <version>${julian-http-client-version}</version>
</dependency>

Gradle

dependencies {
    implementation("com.github.ljtfreitas.julian-http-client:julian-http-client-opentracing:$julianHttpClientVersion")
}

Usage

julian-http-client support for OpenTracing uses interceptors. The original request is modified to include trace-related headers.

import com.github.ljtfreitas.julian.http.opentracing.TracingHTTPRequestInterceptor;
import io.opentracing.Tracer;

interface MyApi {}

Tracer tracer = // ...

TracingHTTPRequestInterceptor tracingInterceptor = new TracingHTTPRequestInterceptor(tracer);

MyApi myApi = new ProxyBuilder()
    .http()
        .interceptors()
            .add(tracingInterceptor)
        .and()
    .and()
    .build(MyApi.class, "http://my.api.com");

And that's it.