opentelemetry-java-instrume.../instrumentation/jetty-httpclient/jetty-httpclient-12.0/library
Lauri Tulmin 888478860d
Replace search.maven.org links (#14626)
2025-09-11 14:22:28 +03:00
..
src Rename method, use Telemetry instead of Metrics (#13574) 2025-03-25 11:03:32 +02:00
README.md Replace search.maven.org links (#14626) 2025-09-11 14:22:28 +03:00
build.gradle.kts

README.md

Library Instrumentation for Jetty HttpClient version 12.0 and higher

Provides OpenTelemetry instrumentation for the Jetty HttpClient, enabling database 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-12.0</artifactId>
    <version>OPENTELEMETRY_VERSION</version>
  </dependency>
</dependencies>

For Gradle, add to your dependencies:

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

Usage

import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.instrumentation.jetty.httpclient.v12_0.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.getHttpClient();

// ... use the httpClient to make requests