-
Notifications
You must be signed in to change notification settings - Fork 1k
Library readmes - batch 3 #14680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library readmes - batch 3 #14680
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Library Instrumentation for Ratpack version 1.7 and higher | ||
|
|
||
| Provides OpenTelemetry instrumentation for [Ratpack](https://ratpack.io/), enabling HTTP client and server spans and | ||
| metrics. | ||
|
|
||
| ## Quickstart | ||
|
|
||
| ### Add these dependencies to your project | ||
|
|
||
| Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-ratpack-1.7). | ||
|
|
||
| For Maven, add to your `pom.xml` dependencies: | ||
|
|
||
| ```xml | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>io.opentelemetry.instrumentation</groupId> | ||
| <artifactId>opentelemetry-ratpack-1.7</artifactId> | ||
| <version>OPENTELEMETRY_VERSION</version> | ||
| </dependency> | ||
| </dependencies> | ||
| ``` | ||
|
|
||
| For Gradle, add to your dependencies: | ||
|
|
||
| ```kotlin | ||
| implementation("io.opentelemetry.instrumentation:opentelemetry-ratpack-1.7:OPENTELEMETRY_VERSION") | ||
| ``` | ||
|
|
||
| ### Usage | ||
|
|
||
| ```java | ||
| import io.opentelemetry.api.OpenTelemetry; | ||
| import io.opentelemetry.instrumentation.ratpack.v1_7.RatpackServerTelemetry; | ||
| import io.opentelemetry.instrumentation.ratpack.v1_7.RatpackClientTelemetry; | ||
| import ratpack.server.RatpackServer; | ||
| import ratpack.http.client.HttpClient; | ||
|
|
||
| public class RatpackExample { | ||
| public static void main(String[] args) throws Exception { | ||
| // Get an OpenTelemetry instance | ||
| OpenTelemetry openTelemetry = ...; | ||
|
|
||
| // Server instrumentation | ||
| RatpackServerTelemetry serverTelemetry = RatpackServerTelemetry.create(openTelemetry); | ||
| RatpackServer.start(server -> { | ||
| server.registryOf(serverTelemetry::configureRegistry); | ||
| server.handlers(chain -> | ||
| chain.get(ctx -> ctx.render("Hello, World!")) | ||
| ); | ||
| }); | ||
|
|
||
| // Client instrumentation | ||
| RatpackClientTelemetry clientTelemetry = RatpackClientTelemetry.create(openTelemetry); | ||
| HttpClient instrumentedHttpClient = clientTelemetry.instrument(HttpClient.of(spec -> {})); | ||
| } | ||
| } | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Library Instrumentation for Project Reactor version 3.1 and higher | ||
|
|
||
| Provides OpenTelemetry instrumentation for [Project Reactor](https://projectreactor.io/), enabling | ||
| context propagation through Reactor's execution model. | ||
|
|
||
| ## Quickstart | ||
|
|
||
| ### Add these dependencies to your project | ||
|
|
||
| Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-reactor-3.1). | ||
|
|
||
| For Maven, add to your `pom.xml` dependencies: | ||
|
|
||
| ```xml | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>io.opentelemetry.instrumentation</groupId> | ||
| <artifactId>opentelemetry-reactor-3.1</artifactId> | ||
| <version>OPENTELEMETRY_VERSION</version> | ||
| </dependency> | ||
| </dependencies> | ||
| ``` | ||
|
|
||
| For Gradle, add to your dependencies: | ||
|
|
||
| ```kotlin | ||
| implementation("io.opentelemetry.instrumentation:opentelemetry-reactor-3.1:OPENTELEMETRY_VERSION") | ||
| ``` | ||
|
|
||
| ### Usage | ||
|
|
||
| ```java | ||
| import io.opentelemetry.api.OpenTelemetry; | ||
| import io.opentelemetry.instrumentation.reactor.v3_1.ContextPropagationOperator; | ||
| import reactor.core.publisher.Mono; | ||
| import reactor.core.publisher.Flux; | ||
|
|
||
| public class ReactorExample { | ||
| public static void main(String[] args) { | ||
| ContextPropagationOperator contextPropagationOperator = ContextPropagationOperator.create(); | ||
| contextPropagationOperator.registerOnEachOperator(); | ||
|
|
||
| Mono<String> mono = Mono.just("Hello, World!"); | ||
| Flux<String> flux = Flux.just("Hello", "World"); | ||
|
|
||
| mono.subscribe(System.out::println); | ||
| flux.subscribe(System.out::println); | ||
|
||
| } | ||
| } | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Library Instrumentation for Restlet version 1.1 and higher | ||
|
|
||
| Provides OpenTelemetry instrumentation for [Restlet](https://restlet.talend.com/), enabling HTTP | ||
| server spans. | ||
|
|
||
| ## Quickstart | ||
|
|
||
| ### Add these dependencies to your project | ||
|
|
||
| Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-restlet-1.1). | ||
|
|
||
| For Maven, add to your `pom.xml` dependencies: | ||
|
|
||
| ```xml | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>io.opentelemetry.instrumentation</groupId> | ||
| <artifactId>opentelemetry-restlet-1.1</artifactId> | ||
| <version>OPENTELEMETRY_VERSION</version> | ||
| </dependency> | ||
| </dependencies> | ||
| ``` | ||
|
|
||
| For Gradle, add to your dependencies: | ||
|
|
||
| ```kotlin | ||
| implementation("io.opentelemetry.instrumentation:opentelemetry-restlet-1.1:OPENTELEMETRY_VERSION") | ||
| ``` | ||
|
|
||
| ### Usage | ||
|
|
||
| ```java | ||
| import io.opentelemetry.api.OpenTelemetry; | ||
| import io.opentelemetry.instrumentation.restlet.v1_1.RestletTelemetry; | ||
| import org.restlet.Filter; | ||
| import org.restlet.Application; | ||
| import org.restlet.Restlet; | ||
|
|
||
| public class RestletExample { | ||
| public static void main(String[] args) throws Exception { | ||
| // Get an OpenTelemetry instance | ||
| OpenTelemetry openTelemetry = ...; | ||
|
|
||
| RestletTelemetry restletTelemetry = RestletTelemetry.create(openTelemetry); | ||
| Filter tracingFilter = restletTelemetry.newFilter("/api"); | ||
|
|
||
| Application application = new Application() { | ||
| @Override | ||
| public Restlet createInboundRoot() { | ||
| return tracingFilter; | ||
| } | ||
| }; | ||
| } | ||
| } | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Library Instrumentation for Restlet version 2.0 and higher | ||
|
|
||
| Provides OpenTelemetry instrumentation for [Restlet](https://restlet.talend.com/), enabling HTTP | ||
| server spans. | ||
|
|
||
| ## Quickstart | ||
|
|
||
| ### Add these dependencies to your project | ||
|
|
||
| Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-restlet-2.0). | ||
|
|
||
| For Maven, add to your `pom.xml` dependencies: | ||
|
|
||
| ```xml | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>io.opentelemetry.instrumentation</groupId> | ||
| <artifactId>opentelemetry-restlet-2.0</artifactId> | ||
| <version>OPENTELEMETRY_VERSION</version> | ||
| </dependency> | ||
| </dependencies> | ||
| ``` | ||
|
|
||
| For Gradle, add to your dependencies: | ||
|
|
||
| ```kotlin | ||
| implementation("io.opentelemetry.instrumentation:opentelemetry-restlet-2.0:OPENTELEMETRY_VERSION") | ||
| ``` | ||
|
|
||
| ### Usage | ||
|
|
||
| ```java | ||
| import io.opentelemetry.api.OpenTelemetry; | ||
| import io.opentelemetry.instrumentation.restlet.v2_0.RestletTelemetry; | ||
| import org.restlet.Application; | ||
| import org.restlet.Restlet; | ||
| import org.restlet.routing.Filter; | ||
|
|
||
| public class RestletExample { | ||
| public static void main(String[] args) throws Exception { | ||
| // Get an OpenTelemetry instance | ||
| OpenTelemetry openTelemetry = ...; | ||
|
|
||
| RestletTelemetry restletTelemetry = RestletTelemetry.create(openTelemetry); | ||
| Filter tracingFilter = restletTelemetry.newFilter("/api"); | ||
|
|
||
| Application application = new Application() { | ||
| @Override | ||
| public Restlet createInboundRoot() { | ||
| return tracingFilter; | ||
| } | ||
| }; | ||
| } | ||
| } | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # Library Instrumentation for RxJava version 1.0 and higher | ||
|
|
||
| Provides OpenTelemetry instrumentation utilities for [RxJava](https://github.com/ReactiveX/RxJava/tree/1.x), | ||
| enabling context propagation through RxJava's execution model. | ||
|
|
||
| **Note**: This library is primarily designed for use by other OpenTelemetry instrumentation | ||
| libraries and framework integrations, not for direct end-user application usage. | ||
|
|
||
| ## Quickstart | ||
|
|
||
| ### Add these dependencies to your project | ||
|
|
||
| Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-rxjava-1.0). | ||
|
|
||
| For Maven, add to your `pom.xml` dependencies: | ||
|
|
||
| ```xml | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>io.opentelemetry.instrumentation</groupId> | ||
| <artifactId>opentelemetry-rxjava-1.0</artifactId> | ||
| <version>OPENTELEMETRY_VERSION</version> | ||
| </dependency> | ||
| </dependencies> | ||
| ``` | ||
|
|
||
| For Gradle, add to your dependencies: | ||
|
|
||
| ```kotlin | ||
| implementation("io.opentelemetry.instrumentation:opentelemetry-rxjava-1.0:OPENTELEMETRY_VERSION") | ||
| ``` | ||
|
|
||
| ### Usage | ||
|
|
||
| This library provides the `TracedOnSubscribe` class for instrumenting RxJava Observables with | ||
| OpenTelemetry spans: | ||
|
|
||
| ```java | ||
| import io.opentelemetry.api.OpenTelemetry; | ||
| import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; | ||
| import io.opentelemetry.instrumentation.rxjava.v1_0.TracedOnSubscribe; | ||
| import rx.Observable; | ||
|
|
||
| public class RxJavaExample { | ||
| public static void main(String[] args) { | ||
| // Get an OpenTelemetry instance | ||
| OpenTelemetry openTelemetry = ...; | ||
|
|
||
| // Create an instrumenter for your specific request type | ||
| Instrumenter<String, Void> instrumenter = Instrumenter.<String, Void>builder( | ||
|
||
| openTelemetry, | ||
| "instrumentation-name", | ||
| request -> "operation-name") | ||
| .buildInstrumenter(); | ||
|
|
||
| // Create a regular Observable | ||
| Observable<String> originalObservable = Observable.just("Hello", "World"); | ||
|
|
||
| // Wrap it with tracing | ||
| Observable<String> tracedObservable = Observable.create( | ||
| new TracedOnSubscribe<>(originalObservable, instrumenter, "request-context")); | ||
|
|
||
| // Subscribe to the traced observable | ||
| tracedObservable.subscribe(System.out::println); | ||
| } | ||
| } | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Library Instrumentation for RxJava version 2.0 and higher | ||
|
|
||
| Provides OpenTelemetry instrumentation for [RxJava](https://github.com/ReactiveX/RxJava), enabling | ||
| context propagation through RxJava's execution model. | ||
|
|
||
| ## Quickstart | ||
|
|
||
| ### Add these dependencies to your project | ||
|
|
||
| Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-rxjava-2.0). | ||
|
|
||
| For Maven, add to your `pom.xml` dependencies: | ||
|
|
||
| ```xml | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>io.opentelemetry.instrumentation</groupId> | ||
| <artifactId>opentelemetry-rxjava-2.0</artifactId> | ||
| <version>OPENTELEMETRY_VERSION</version> | ||
| </dependency> | ||
| </dependencies> | ||
| ``` | ||
|
|
||
| For Gradle, add to your dependencies: | ||
|
|
||
| ```kotlin | ||
| implementation("io.opentelemetry.instrumentation:opentelemetry-rxjava-2.0:OPENTELEMETRY_VERSION") | ||
| ``` | ||
|
|
||
| ### Usage | ||
|
|
||
| Enable RxJava instrumentation by calling `TracingAssembly.enable()` once during application startup. | ||
| This will automatically instrument all RxJava operations in your application: | ||
|
|
||
| ```java | ||
| import io.opentelemetry.instrumentation.rxjava.v2_0.TracingAssembly; | ||
| import io.reactivex.Observable; | ||
| import io.reactivex.Flowable; | ||
|
|
||
| public class RxJavaExample { | ||
| public static void main(String[] args) { | ||
| // Enable RxJava instrumentation globally | ||
| TracingAssembly tracingAssembly = TracingAssembly.create(); | ||
| tracingAssembly.enable(); | ||
|
|
||
| // All RxJava operations will now be automatically instrumented | ||
| Observable<String> observable = Observable.just("Hello", "World"); | ||
| Flowable<String> flowable = Flowable.just("Hello", "World"); | ||
|
|
||
| observable.subscribe(System.out::println); | ||
| flowable.subscribe(System.out::println); | ||
| } | ||
| } | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Library Instrumentation for RxJava version 3.1.1 and higher | ||
|
|
||
| Provides OpenTelemetry instrumentation for [RxJava](https://github.com/ReactiveX/RxJava), enabling | ||
| context propagation through RxJava's execution model. | ||
|
|
||
| ## Quickstart | ||
|
|
||
| ### Add these dependencies to your project | ||
|
|
||
| Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-rxjava-3.1.1). | ||
|
|
||
| For Maven, add to your `pom.xml` dependencies: | ||
|
|
||
| ```xml | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>io.opentelemetry.instrumentation</groupId> | ||
| <artifactId>opentelemetry-rxjava-3.1.1</artifactId> | ||
| <version>OPENTELEMETRY_VERSION</version> | ||
| </dependency> | ||
| </dependencies> | ||
| ``` | ||
|
|
||
| For Gradle, add to your dependencies: | ||
|
|
||
| ```kotlin | ||
| implementation("io.opentelemetry.instrumentation:opentelemetry-rxjava-3.1.1:OPENTELEMETRY_VERSION") | ||
| ``` | ||
|
|
||
| ### Usage | ||
|
|
||
| Enable RxJava instrumentation by calling `TracingAssembly.enable()` once during application startup. | ||
| This will automatically instrument all RxJava operations in your application: | ||
|
|
||
| ```java | ||
| import io.opentelemetry.instrumentation.rxjava.v3_1_1.TracingAssembly; | ||
| import io.reactivex.rxjava3.core.Observable; | ||
| import io.reactivex.rxjava3.core.Flowable; | ||
|
|
||
| public class RxJavaExample { | ||
| public static void main(String[] args) { | ||
| // Enable RxJava instrumentation globally | ||
| TracingAssembly tracingAssembly = TracingAssembly.create(); | ||
| tracingAssembly.enable(); | ||
|
|
||
| // All RxJava operations will now be automatically instrumented | ||
| Observable<String> observable = Observable.just("Hello", "World"); | ||
| Flowable<String> flowable = Flowable.just("Hello", "World"); | ||
|
|
||
| observable.subscribe(System.out::println); | ||
| flowable.subscribe(System.out::println); | ||
| } | ||
| } | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally like the okhttp code snippet more where we have a method that accepts opentelemety instance and returns instrumented client.