Skip to content

Commit 772d1fc

Browse files
jaydelucamznet
authored andcommitted
Library readmes - batch 3 (open-telemetry#14680)
1 parent 8fdac7d commit 772d1fc

File tree

7 files changed

+329
-0
lines changed

7 files changed

+329
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Library Instrumentation for Ratpack version 1.7 and higher
2+
3+
Provides OpenTelemetry instrumentation for [Ratpack](https://ratpack.io/), enabling HTTP client and
4+
server spans and metrics.
5+
6+
## Quickstart
7+
8+
### Add these dependencies to your project
9+
10+
Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-ratpack-1.7).
11+
12+
For Maven, add to your `pom.xml` dependencies:
13+
14+
```xml
15+
<dependencies>
16+
<dependency>
17+
<groupId>io.opentelemetry.instrumentation</groupId>
18+
<artifactId>opentelemetry-ratpack-1.7</artifactId>
19+
<version>OPENTELEMETRY_VERSION</version>
20+
</dependency>
21+
</dependencies>
22+
```
23+
24+
For Gradle, add to your dependencies:
25+
26+
```kotlin
27+
implementation("io.opentelemetry.instrumentation:opentelemetry-ratpack-1.7:OPENTELEMETRY_VERSION")
28+
```
29+
30+
### Usage
31+
32+
The instrumentation library provides implementations for both server and client instrumentation
33+
that wrap Ratpack components.
34+
35+
```java
36+
import io.opentelemetry.api.OpenTelemetry;
37+
import io.opentelemetry.instrumentation.ratpack.v1_7.RatpackServerTelemetry;
38+
import io.opentelemetry.instrumentation.ratpack.v1_7.RatpackClientTelemetry;
39+
import ratpack.server.RatpackServer;
40+
import ratpack.http.client.HttpClient;
41+
42+
public class RatpackConfiguration {
43+
44+
// Create a server with OpenTelemetry instrumentation
45+
public RatpackServer createTracedServer(OpenTelemetry openTelemetry) throws Exception {
46+
RatpackServerTelemetry serverTelemetry = RatpackServerTelemetry.create(openTelemetry);
47+
return RatpackServer.start(server -> {
48+
server.registryOf(serverTelemetry::configureRegistry);
49+
server.handlers(chain ->
50+
chain.get(ctx -> ctx.render("Hello, World!"))
51+
);
52+
});
53+
}
54+
55+
// Create an instrumented HttpClient
56+
public HttpClient createTracedClient(OpenTelemetry openTelemetry) {
57+
RatpackClientTelemetry clientTelemetry = RatpackClientTelemetry.create(openTelemetry);
58+
return clientTelemetry.instrument(createClient());
59+
}
60+
61+
// Configuration of the HttpClient goes here
62+
private HttpClient createClient() {
63+
return HttpClient.of(spec -> {});
64+
}
65+
}
66+
```
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Library Instrumentation for Project Reactor version 3.1 and higher
2+
3+
Provides OpenTelemetry instrumentation for [Project Reactor](https://projectreactor.io/), enabling
4+
context propagation through Reactor's execution model.
5+
6+
## Quickstart
7+
8+
### Add these dependencies to your project
9+
10+
Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-reactor-3.1).
11+
12+
For Maven, add to your `pom.xml` dependencies:
13+
14+
```xml
15+
<dependencies>
16+
<dependency>
17+
<groupId>io.opentelemetry.instrumentation</groupId>
18+
<artifactId>opentelemetry-reactor-3.1</artifactId>
19+
<version>OPENTELEMETRY_VERSION</version>
20+
</dependency>
21+
</dependencies>
22+
```
23+
24+
For Gradle, add to your dependencies:
25+
26+
```kotlin
27+
implementation("io.opentelemetry.instrumentation:opentelemetry-reactor-3.1:OPENTELEMETRY_VERSION")
28+
```
29+
30+
### Usage
31+
32+
```java
33+
import io.opentelemetry.api.OpenTelemetry;
34+
import io.opentelemetry.instrumentation.reactor.v3_1.ContextPropagationOperator;
35+
import reactor.core.publisher.Mono;
36+
import reactor.core.publisher.Flux;
37+
38+
public class ReactorExample {
39+
public static void main(String[] args) {
40+
ContextPropagationOperator contextPropagationOperator = ContextPropagationOperator.create();
41+
contextPropagationOperator.registerOnEachOperator();
42+
43+
Mono<String> mono = Mono.just("Hello, World!");
44+
Flux<String> flux = Flux.just("Hello", "World");
45+
...
46+
}
47+
}
48+
```
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Library Instrumentation for Restlet version 1.1 and higher
2+
3+
Provides OpenTelemetry instrumentation for [Restlet](https://restlet.talend.com/), enabling HTTP
4+
server spans.
5+
6+
## Quickstart
7+
8+
### Add these dependencies to your project
9+
10+
Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-restlet-1.1).
11+
12+
For Maven, add to your `pom.xml` dependencies:
13+
14+
```xml
15+
<dependencies>
16+
<dependency>
17+
<groupId>io.opentelemetry.instrumentation</groupId>
18+
<artifactId>opentelemetry-restlet-1.1</artifactId>
19+
<version>OPENTELEMETRY_VERSION</version>
20+
</dependency>
21+
</dependencies>
22+
```
23+
24+
For Gradle, add to your dependencies:
25+
26+
```kotlin
27+
implementation("io.opentelemetry.instrumentation:opentelemetry-restlet-1.1:OPENTELEMETRY_VERSION")
28+
```
29+
30+
### Usage
31+
32+
```java
33+
import io.opentelemetry.api.OpenTelemetry;
34+
import io.opentelemetry.instrumentation.restlet.v1_1.RestletTelemetry;
35+
import org.restlet.Filter;
36+
import org.restlet.Application;
37+
import org.restlet.Restlet;
38+
39+
public class RestletExample {
40+
public static void main(String[] args) throws Exception {
41+
// Get an OpenTelemetry instance
42+
OpenTelemetry openTelemetry = ...;
43+
44+
RestletTelemetry restletTelemetry = RestletTelemetry.create(openTelemetry);
45+
Filter tracingFilter = restletTelemetry.newFilter("/api");
46+
47+
Application application = new Application() {
48+
@Override
49+
public Restlet createInboundRoot() {
50+
return tracingFilter;
51+
}
52+
};
53+
}
54+
}
55+
```
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Library Instrumentation for Restlet version 2.0 and higher
2+
3+
Provides OpenTelemetry instrumentation for [Restlet](https://restlet.talend.com/), enabling HTTP
4+
server spans.
5+
6+
## Quickstart
7+
8+
### Add these dependencies to your project
9+
10+
Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-restlet-2.0).
11+
12+
For Maven, add to your `pom.xml` dependencies:
13+
14+
```xml
15+
<dependencies>
16+
<dependency>
17+
<groupId>io.opentelemetry.instrumentation</groupId>
18+
<artifactId>opentelemetry-restlet-2.0</artifactId>
19+
<version>OPENTELEMETRY_VERSION</version>
20+
</dependency>
21+
</dependencies>
22+
```
23+
24+
For Gradle, add to your dependencies:
25+
26+
```kotlin
27+
implementation("io.opentelemetry.instrumentation:opentelemetry-restlet-2.0:OPENTELEMETRY_VERSION")
28+
```
29+
30+
### Usage
31+
32+
```java
33+
import io.opentelemetry.api.OpenTelemetry;
34+
import io.opentelemetry.instrumentation.restlet.v2_0.RestletTelemetry;
35+
import org.restlet.Application;
36+
import org.restlet.Restlet;
37+
import org.restlet.routing.Filter;
38+
39+
public class RestletExample {
40+
public static void main(String[] args) throws Exception {
41+
// Get an OpenTelemetry instance
42+
OpenTelemetry openTelemetry = ...;
43+
44+
RestletTelemetry restletTelemetry = RestletTelemetry.create(openTelemetry);
45+
Filter tracingFilter = restletTelemetry.newFilter("/api");
46+
47+
Application application = new Application() {
48+
@Override
49+
public Restlet createInboundRoot() {
50+
return tracingFilter;
51+
}
52+
};
53+
}
54+
}
55+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
classification: internal
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Library Instrumentation for RxJava version 2.0 and higher
2+
3+
Provides OpenTelemetry instrumentation for [RxJava](https://github.com/ReactiveX/RxJava), enabling
4+
context propagation through RxJava's execution model.
5+
6+
## Quickstart
7+
8+
### Add these dependencies to your project
9+
10+
Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-rxjava-2.0).
11+
12+
For Maven, add to your `pom.xml` dependencies:
13+
14+
```xml
15+
<dependencies>
16+
<dependency>
17+
<groupId>io.opentelemetry.instrumentation</groupId>
18+
<artifactId>opentelemetry-rxjava-2.0</artifactId>
19+
<version>OPENTELEMETRY_VERSION</version>
20+
</dependency>
21+
</dependencies>
22+
```
23+
24+
For Gradle, add to your dependencies:
25+
26+
```kotlin
27+
implementation("io.opentelemetry.instrumentation:opentelemetry-rxjava-2.0:OPENTELEMETRY_VERSION")
28+
```
29+
30+
### Usage
31+
32+
Enable RxJava instrumentation by calling `TracingAssembly.enable()` once during application startup.
33+
This will automatically instrument all RxJava operations in your application:
34+
35+
```java
36+
import io.opentelemetry.instrumentation.rxjava.v2_0.TracingAssembly;
37+
import io.reactivex.Observable;
38+
import io.reactivex.Flowable;
39+
40+
public class RxJavaExample {
41+
public static void main(String[] args) {
42+
// Enable RxJava instrumentation globally
43+
TracingAssembly tracingAssembly = TracingAssembly.create();
44+
tracingAssembly.enable();
45+
46+
// All RxJava operations will now be automatically instrumented
47+
Observable<String> observable = Observable.just("Hello", "World");
48+
Flowable<String> flowable = Flowable.just("Hello", "World");
49+
...
50+
}
51+
}
52+
```
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Library Instrumentation for RxJava version 3.1.1 and higher
2+
3+
Provides OpenTelemetry instrumentation for [RxJava](https://github.com/ReactiveX/RxJava), enabling
4+
context propagation through RxJava's execution model.
5+
6+
## Quickstart
7+
8+
### Add these dependencies to your project
9+
10+
Replace `OPENTELEMETRY_VERSION` with the [latest release](https://central.sonatype.com/artifact/io.opentelemetry.instrumentation/opentelemetry-rxjava-3.1.1).
11+
12+
For Maven, add to your `pom.xml` dependencies:
13+
14+
```xml
15+
<dependencies>
16+
<dependency>
17+
<groupId>io.opentelemetry.instrumentation</groupId>
18+
<artifactId>opentelemetry-rxjava-3.1.1</artifactId>
19+
<version>OPENTELEMETRY_VERSION</version>
20+
</dependency>
21+
</dependencies>
22+
```
23+
24+
For Gradle, add to your dependencies:
25+
26+
```kotlin
27+
implementation("io.opentelemetry.instrumentation:opentelemetry-rxjava-3.1.1:OPENTELEMETRY_VERSION")
28+
```
29+
30+
### Usage
31+
32+
Enable RxJava instrumentation by calling `TracingAssembly.enable()` once during application startup.
33+
This will automatically instrument all RxJava operations in your application:
34+
35+
```java
36+
import io.opentelemetry.instrumentation.rxjava.v3_1_1.TracingAssembly;
37+
import io.reactivex.rxjava3.core.Observable;
38+
import io.reactivex.rxjava3.core.Flowable;
39+
40+
public class RxJavaExample {
41+
public static void main(String[] args) {
42+
// Enable RxJava instrumentation globally
43+
TracingAssembly tracingAssembly = TracingAssembly.create();
44+
tracingAssembly.enable();
45+
46+
// All RxJava operations will now be automatically instrumented
47+
Observable<String> observable = Observable.just("Hello", "World");
48+
Flowable<String> flowable = Flowable.just("Hello", "World");
49+
...
50+
}
51+
}
52+
```

0 commit comments

Comments
 (0)