Skip to content

Commit a1a127a

Browse files
committed
Fix README
1 parent 3a8e639 commit a1a127a

File tree

4 files changed

+39
-40
lines changed

4 files changed

+39
-40
lines changed

opentelemetry/README.md

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,12 @@
11
# OpenTelemetry-Ktor Demo
22

3-
## Running
4-
5-
**Note:** You need to have [Docker](https://www.docker.com/) installed and running to run the sample.
6-
7-
To run a sample, first, execute the following command in an `opentelemetry` directory:
8-
9-
```bash
10-
./gradlew :runWithDocker
11-
```
12-
13-
It will start a `Jaeger` in the docker container (`Jaeger UI` available on http://localhost:16686/search) and
14-
then it will start a `server` on http://localhost:8080/
15-
16-
Then, to run the client, which will send requests to a server, you can execute the following command in
17-
an `opentelemetry` directory:
18-
19-
```bash
20-
./gradlew :client:run
21-
```
22-
23-
[OpenTelemetry](https://opentelemetry.io/) has support for `Ktor`, you can find source
24-
code [here](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/ktor).
25-
It contains plugins for client and server: `KtorClientTracing` and `KtorServerTracing`.
26-
27-
**Note:** In this example, we use
28-
an [Autoconfiguration OpenTelemetry instance](https://opentelemetry.io/docs/languages/java/instrumentation/#automatic-configuration),
29-
we set environment variables `OTEL_METRICS_EXPORTER` and `OTEL_EXPORTER_OTLP_ENDPOINT`
30-
in [build.gradle.kts](./build.gradle.kts) file.
31-
You can find more information about these environment variables
32-
in the [OpenTelemetry documentation](https://opentelemetry.io/docs/languages/sdk-configuration/).
3+
[OpenTelemetry](https://opentelemetry.io/) provides support for Ktor with the `KtorClientTracing`and `KtorServerTracing`
4+
plugins for the Ktor client and server respectively. For the source code, see
5+
the [repository on GitHub](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/ktor).
336

34-
## Motivation
7+
This project contains extension functions for plugins that allow you to write code in the Ktor DSL style.
358

36-
This project contains extension functions for plugins that allow you to write code in the Ktor DSL style. \
37-
For example, you can rewrite the next code:
9+
Take the following code as an example:
3810

3911
```kotlin
4012
install(KtorServerTracing) {
@@ -56,7 +28,7 @@ install(KtorServerTracing) {
5628
}
5729
```
5830

59-
To a more readable for `Ktor` style:
31+
Rewritten in Ktor DSL style, it looks like the following:
6032

6133
```kotlin
6234
install(KtorServerTracing) {
@@ -75,14 +47,41 @@ the [extractions](./client/src/main/kotlin/opentelemetry/ktor/example/plugins/op
7547
And you can find all extensions for the server plugin `KtorServerTracing` in
7648
the [extractions](./server/src/main/kotlin/opentelemetry/ktor/example/plugins/opentelemetry/extractions/) folder.
7749

78-
## Examples
50+
## Running
51+
52+
**Note:** You need to have [Docker](https://www.docker.com/) installed and running to run the sample.
53+
54+
To run this sample, execute the following command from the `opentelemetry` directory::
55+
56+
```bash
57+
./gradlew :runWithDocker
58+
```
59+
60+
It will start a `Jaeger` in the docker container (`Jaeger UI` available on http://localhost:16686/search) and
61+
then it will start a `server` on http://localhost:8080/
62+
63+
Then, to run the client, which will send requests to a server, you can execute the following command in
64+
an `opentelemetry` directory:
65+
66+
```bash
67+
./gradlew :client:run
68+
```
69+
70+
**Note:** In this example, we use
71+
an [Autoconfiguration OpenTelemetry instance](https://opentelemetry.io/docs/languages/java/instrumentation/#automatic-configuration),
72+
we set environment variables `OTEL_METRICS_EXPORTER` and `OTEL_EXPORTER_OTLP_ENDPOINT`
73+
in [build.gradle.kts](./build.gradle.kts) file.
74+
You can find more information about these environment variables
75+
in the [OpenTelemetry documentation](https://opentelemetry.io/docs/languages/sdk-configuration/).
7976

80-
Let's see what we will see in the `Jaeger UI` after running the server (with Docker) and client:
77+
Let's check what we will see in the `Jaeger UI` after running the server (with Docker) and the client:
8178

82-
1. We can see two services that send opentelemetry data: `opentelemetry-ktor-sample-server`
83-
and `opentelemetry-ktor-sample-client`:
79+
1. We can see two our services that send opentelemetry data: `opentelemetry-ktor-sample-server`
80+
and `opentelemetry-ktor-sample-client`, and service `jaeger-all-in-one`, it's `Jaeger` tracing some of
81+
its components:
8482
![img.png](images/1.png)
85-
2. If we choose `opentelemetry-ktor-sample-server` service, we will see the next traces:
83+
2. If you select `opentelemetry-ktor-sample-server` service and click on **Find traces**, you will see a list of traces:
8684
![img.png](images/2.png)
87-
3. And if we choose one of the traces:
85+
3. If you click on one of those traces, you will be navigated to a screen providing detailed information about the
86+
selected trace:
8887
![img.png](images/3.png)

opentelemetry/images/1.png

3.54 KB
Loading

opentelemetry/images/2.png

67.1 KB
Loading

opentelemetry/images/3.png

8.93 KB
Loading

0 commit comments

Comments
 (0)