opentracing-httpcomponents


License

License

GroupId

GroupId

com.lucidchart
ArtifactId

ArtifactId

opentracing-httpcomponents
Last Version

Last Version

0.9
Release Date

Release Date

Type

Type

jar
Description

Description

opentracing-httpcomponents
opentracing-httpcomponents
Project Organization

Project Organization

OpenTracing
Source Code Management

Source Code Management

https://github.com/lucidsoftware/opentracing-httpcomponents

Download opentracing-httpcomponents

How to add to project

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

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

OpenTracing for HttpComponents

Build Status Maven Version

This library works with GlobalTracer and DefaultSpanManager.

HttpClient

Install com.lucidchart:opentracing-httpclient:<version>

import org.apache.http.impl.client.CloseableHttpClient;
import io.opentracing.contrib.httpcomponents.SpanHttp;
import io.opentracing.threadcontext.ContextSpan;
import io.opentracing.Span;

Span span = ...
CloseableHttpClient client = SpanHttp.trace().build();
ContextSpan.set(span).supplyException2(() -> {
  try {
    client.execute(new HttpGet("http://example.org/"))
  } catch (IOException | ClientProtocolException e) {
  }
})

If you are already using a custom subclass of HttpClientBuilder, override the decorateMainExec of the class.

import org.apache.http.impl.execchain.*;
import io.opentracing.contrib.httpcomponents.*;

new MyHttpClientBuilder {
    protected ClientExecChain decorateMainExec(ClientExecChain exec) {
        new DefaultSpanManagerExec(super.decorateMainExec(exec), new HttpTagger[] { new StandardHttpTagger(); }
    }
}

HttpAsyncClient

Install com.lucidchart:opentracing-httpasyncclient:<version>.

import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
import org.apache.http.impl.nio.client.HttpAsyncClients;
import io.opentracing.contrib.httpcomponents.SpanHttpAsync;
import io.opentracing.threadcontext.ContentSpan;
import io.opentracing.Span;

Span span = ...
CloseableHttpAyncClient client = SpanHttpAsync.trace(HttpAsyncClients.createDefault());
ContextSpan.set(span).supplyException2(() -> {
  try {
    client.execute(new HttpGet("http://example.org/"), null)
  } catch (IOException | ClientProtocolException e) {
  }
})

Taggers

Tags for client Spans come from io.opentracing.contrib.httpcomponents.HttpTagger instances.

Built-in taggers:

  • StandardHttpTagger
  • ContentHttpTagger
com.lucidchart

Lucid Software, Inc

Versions

Version
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1