-
Notifications
You must be signed in to change notification settings - Fork 890
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into rename-ktor-tracing
- Loading branch information
Showing
57 changed files
with
1,542 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...y/src/main/java/io/opentelemetry/instrumentation/ratpack/v1_7/RatpackClientTelemetry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.ratpack.v1_7; | ||
|
||
import io.opentelemetry.api.OpenTelemetry; | ||
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; | ||
import io.opentelemetry.instrumentation.ratpack.v1_7.internal.OpenTelemetryHttpClient; | ||
import ratpack.http.client.HttpClient; | ||
import ratpack.http.client.HttpResponse; | ||
import ratpack.http.client.RequestSpec; | ||
|
||
/** | ||
* Entrypoint for instrumenting Ratpack http client. | ||
* | ||
* <p>To apply OpenTelemetry instrumentation to a http client, wrap the {@link HttpClient} using | ||
* {@link #instrument(HttpClient)}. | ||
* | ||
* <pre>{@code | ||
* RatpackClientTelemetry telemetry = RatpackClientTelemetry.create(OpenTelemetrySdk.builder() | ||
* ... | ||
* .build()); | ||
* HttpClient instrumentedHttpClient = telemetry.instrument(httpClient); | ||
* }</pre> | ||
*/ | ||
public final class RatpackClientTelemetry { | ||
|
||
/** | ||
* Returns a new {@link RatpackClientTelemetry} configured with the given {@link OpenTelemetry}. | ||
*/ | ||
public static RatpackClientTelemetry create(OpenTelemetry openTelemetry) { | ||
return builder(openTelemetry).build(); | ||
} | ||
|
||
/** | ||
* Returns a new {@link RatpackClientTelemetryBuilder} configured with the given {@link | ||
* OpenTelemetry}. | ||
*/ | ||
public static RatpackClientTelemetryBuilder builder(OpenTelemetry openTelemetry) { | ||
return new RatpackClientTelemetryBuilder(openTelemetry); | ||
} | ||
|
||
private final OpenTelemetryHttpClient httpClientInstrumenter; | ||
|
||
RatpackClientTelemetry(Instrumenter<RequestSpec, HttpResponse> clientInstrumenter) { | ||
httpClientInstrumenter = new OpenTelemetryHttpClient(clientInstrumenter); | ||
} | ||
|
||
/** Returns instrumented instance of {@link HttpClient} with OpenTelemetry. */ | ||
public HttpClient instrument(HttpClient httpClient) throws Exception { | ||
return httpClientInstrumenter.instrument(httpClient); | ||
} | ||
} |
Oops, something went wrong.