Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Library Instrumentation for Jetty HttpClient version 9.2 and higher

Provides OpenTelemetry instrumentation for the Jetty HttpClient, enabling http client spans and metrics.

Quickstart

Add these dependencies to your project

Replace OPENTELEMETRY_VERSION with the latest release.

For Maven, add to your pom.xml dependencies:

<dependencies>
  <dependency>
    <groupId>io.opentelemetry.instrumentation</groupId>
    <artifactId>opentelemetry-jetty-httpclient-9.2</artifactId>
    <version>OPENTELEMETRY_VERSION</version>
  </dependency>
</dependencies>

For Gradle, add to your dependencies:

implementation("io.opentelemetry.instrumentation:opentelemetry-jetty-httpclient-9.2:OPENTELEMETRY_VERSION")

Usage

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.jetty.httpclient.v9_2.JettyClientTelemetry;
import org.eclipse.jetty.client.HttpClient;

// ...

// Get an OpenTelemetry instance
OpenTelemetry openTelemetry = ...;

// Create a JettyClientTelemetry instance
JettyClientTelemetry telemetry = JettyClientTelemetry.create(openTelemetry);

// Get a traced HttpClient
HttpClient httpClient = telemetry.createHttpClient();

// ... use the httpClient to make requests