Skip to content

Commit ed24280

Browse files
authored
Update READMEs (#830)
1 parent 331bce1 commit ed24280

File tree

16 files changed

+196
-144
lines changed

16 files changed

+196
-144
lines changed

README.md

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,36 @@
11
# Java OpenTelemetry Examples
22

3-
This module contains a set of fully-functional, working examples of using the
4-
OpenTelemetry Java APIs and SDK that should all be able to be run locally. Some
5-
of them assume you have docker running on your local machine.
3+
This repository contains a set of fully functional, working examples of using the
4+
OpenTelemetry Java APIs and SDK. All examples can be run locally. Some
5+
examples require Docker to be running on your local machine.
66

7-
## Example modules:
7+
## Requirements
8+
9+
Java 17 or higher is required to build the examples in this repository.
10+
To check your Java version, run:
11+
12+
```bash
13+
java -version
14+
```
15+
16+
To build the all of examples, run:
17+
18+
```bash
19+
./gradlew assemble
20+
```
21+
22+
## Example Modules
823

924
- [Using the SDK AutoConfiguration module](autoconfigure)
10-
- This module contains a fully-functional example of using the autoconfigure
25+
- This module contains a fully functional example of using the autoconfigure
1126
SDK extension module to configure the SDK using only environment
1227
variables (or system properties).
1328
- Note: the `opentelemetry-sdk-extension-autoconfigure` module is still
1429
experimental at this time.
1530
- [Manual instrumentation of HTTP](http)
1631
- This module provides an example of writing manual instrumentation for
1732
HTTP, both client and server.
18-
- Note more production-ready instrumentation for HTTP is provided as a part
33+
- Note: More production-ready instrumentation for HTTP is provided as part
1934
of the [OpenTelemetry Java Instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation)
2035
project.
2136
- [Manual span creation and baggage propagation](manual-tracing)
@@ -24,53 +39,53 @@ of them assume you have docker running on your local machine.
2439
- Additionally, it demonstrates how to use the OpenTelemetry API to
2540
propagate baggage items.
2641
- [Configuring the Jaeger Exporter](jaeger)
27-
- This module contains a fully-functional example of configuring the
28-
OpenTelemetry SDK to use a Jaeger exporter, and send some spans to it
42+
- This module contains a fully functional example of configuring the
43+
OpenTelemetry SDK to use a Jaeger exporter and send spans to it
2944
using the OpenTelemetry API.
30-
- Note: this example requires having docker installed to run the example.
45+
- Note: This example requires Docker to be installed.
3146
- [Using the OpenTelemetry Java Agent](javaagent)
3247
- This module demonstrates using the OpenTelemetry Java Agent with a simple
33-
spring boot application. Traces, metrics, and logs are exported to a
48+
Spring Boot application. Traces, metrics, and logs are exported to a
3449
collector via OTLP.
3550
- [Spring native image telemetry with OpenTelemetry Spring Starter](spring-native)
3651
- This module demonstrates using the OpenTelemetry Spring Boot starter with a
37-
Graal VM native image. Traces and metrics are exported to a collector via OTLP.
52+
GraalVM native image. Traces and metrics are exported to a collector via OTLP.
3853
- [Configuring Log Appenders](log-appender)
3954
- This module demonstrates how to configure the Log4j and Logback appenders to
4055
bridge logs into the OpenTelemetry Log SDK.
4156
- [Configuring the Logging Exporters](logging)
42-
- This module contains a fully-functional example of configuring the
57+
- This module contains a fully functional example of configuring the
4358
OpenTelemetry SDK to use a logging exporter.
44-
- [Exporting Application logs using JSON logging in Kubernetes](logging-k8s-stdout-otlp-json)
59+
- [Exporting application logs using JSON logging in Kubernetes](logging-k8s-stdout-otlp-json)
4560
- This module demonstrates how to export application logs using JSON logging
4661
in Kubernetes.
4762
- [Using the OpenTelemetry metrics API](metrics)
4863
- This module contains examples of using the OpenTelemetry metrics APIs.
4964
- [Using OpenTelemetry Micrometer shim](micrometer-shim)
50-
- This module contains an example of a typical micrometer setup (spring boot
51-
with spring boot actuator) configured to bridge metrics to OpenTelemetry
52-
with the micrometer shim.
53-
- Note: the micrometer shim is still experimental at this time.
65+
- This module contains an example of a typical Micrometer setup (Spring Boot
66+
with Spring Boot Actuator) configured to bridge metrics to OpenTelemetry
67+
with the Micrometer shim.
68+
- Note: The Micrometer shim is still experimental at this time.
5469
- [Setting up OTLP exporters](otlp)
55-
- OTLP is the OpenTelemetry Protocol. This module will demonstrate how to
56-
configure the OTLP exporters, and send data to the OpenTelemetry collector
70+
- OTLP is the OpenTelemetry Protocol. This module demonstrates how to
71+
configure the OTLP exporters and send data to the OpenTelemetry Collector
5772
using them.
58-
- Note: this example requires having docker installed to run the example.
73+
- Note: This example requires Docker to be installed.
5974
- [Setting up the Prometheus exporter](prometheus)
60-
- The module shows how to configure the OpenTelemetry SDK to expose an
75+
- This module shows how to configure the OpenTelemetry SDK to expose an
6176
endpoint that can be scraped by Prometheus.
62-
- Note: the prometheus metric reader is still experimental at this time.
77+
- Note: The Prometheus metric reader is still experimental at this time.
6378
- [Manually Configuring the SDK](sdk-usage)
64-
- This module shows some concrete examples of manually configuring the Java
65-
OpenTelemetry SDK for Tracing.
79+
- This module shows some concrete examples of manually configuring the
80+
OpenTelemetry SDK for tracing.
6681
- [Telemetry Testing](telemetry-testing)
67-
- This module demonstrates how to test OpenTelemetry instrumentation with a
82+
- This module demonstrates how to test OpenTelemetry instrumentation with
6883
MockServer.
6984
- [Setting up the Zipkin exporter](zipkin)
70-
- This module contains a fully-functional example of configuring the
71-
OpenTelemetry SDK to use a Zipkin exporter, and send some spans to a
72-
zipkin backend using the OpenTelemetry API.
73-
- Note: this example requires having docker installed to run the example.
85+
- This module contains a fully functional example of configuring the
86+
OpenTelemetry SDK to use a Zipkin exporter and send spans to a
87+
Zipkin backend using the OpenTelemetry API.
88+
- Note: This example requires Docker to be installed.
7489

7590
## Contributing
7691

autoconfigure/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
# SDK autoconfiguration example
1+
# SDK Autoconfiguration Example
22

33
This is a simple example that demonstrates the usage of
44
the [OpenTelemetry SDK Autoconfigure](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure)
55
module.
66

77
## Prerequisites
88

9-
* Java 1.8
9+
* Java 17 or higher is required to run Gradle and build this example
10+
* Java 8 or higher may be used to run the example once it has been built
1011

11-
## How to run
12+
## How to Run
1213

13-
First build this example application:
14+
First, build this example application:
1415

1516
```shell
1617
../gradlew shadowJar

declarative-configuration/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ This example demonstrates how to use [declarative configuration](https://opentel
44

55
The configuration file is located at [otel-sdk-config.yaml](./otel-sdk-config.yaml).
66

7-
# How to run
7+
# How to Run
88

99
## Prerequisites
1010

11-
* Java 1.8
11+
* Java 17 or higher is required to run Gradle and build this example
12+
* Java 8 or higher may be used to run the example once it has been built
1213

1314
## Run
1415

@@ -19,4 +20,4 @@ export OTEL_EXPERIMENTAL_CONFIG_FILE=$(pwd)/otel-sdk-config.yaml
1920

2021
Observe how data is printed to the console as configured in [otel-sdk-config.yaml](./otel-sdk-config.yaml).
2122

22-
For use with the OpenTelemetry Java, see [Java Agent declarative configuration](../javaagent/README.md#declarative-configuration).
23+
For use with the OpenTelemetry Java Agent, see [Java Agent declarative configuration](../javaagent/README.md#declarative-configuration).

grpc/README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
# GRPC Example
1+
# gRPC Example
22

33
**Note:** This is an advanced scenario useful for people who want to *manually* instrument their own code.
4-
(If you're using the [java agent](https://github.com/open-telemetry/opentelemetry-java-instrumentation), you get this instrumentation "out-of-the-box" and this isn't necessary.)
4+
(If you're using the [Java agent](https://github.com/open-telemetry/opentelemetry-java-instrumentation), you get this instrumentation "out-of-the-box" and this isn't necessary.)
55

66
This is a simple example that demonstrates how to use the OpenTelemetry SDK
7-
to *manually* instrument a simple GRPC based Client/Server application.
7+
to *manually* instrument a simple gRPC-based client/server application.
88
This example utilizes the [opentelemetry-grpc-1.6](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/grpc-1.6/library/README.md#library-instrumentation-for-grpc-160)
9-
to instrument both the GRPC client and server.
9+
library to instrument both the gRPC client and server.
1010

11-
# How to run
11+
# How to Run
1212

1313
## Prerequisites
14-
* Be on the grpc project root folder
14+
15+
* Java 17 or higher is required to run Gradle and build this example
16+
* Java 8 or higher may be used to run the example once it has been built
17+
18+
Be in the gRPC project root folder:
19+
1520
```shell script
1621
cd grpc/
1722
```

http/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
# HTTP Example
22

3-
**Note:** This is an advanced scenario useful for people that want to *manually* instrument their own code.
3+
**Note:** This is an advanced scenario useful for people who want to *manually* instrument their own code.
44

5-
This is a simple example that demonstrates how to use the OpenTelemetry SDK
6-
to *manually* instrument a simple HTTP based Client/Server application.
7-
The example creates the **Root Span** on the client and sends the context
5+
This is a simple example that demonstrates how to use the OpenTelemetry SDK
6+
to *manually* instrument a simple HTTP-based client/server application.
7+
The example creates the **root span** on the client and sends the context
88
over the HTTP request. On the server side, the example shows how to extract the context
9-
and create a **Child Span** with attached a **Span Event**.
9+
and create a **child span** with an attached **span event**.
1010

11-
# How to run
11+
# How to Run
1212

1313
## Prerequisites
14-
* Java 1.8.231
15-
* Be on the project root folder
14+
15+
* Java 17 or higher is required to run Gradle and build this example
16+
* Java 8 or higher may be used to run the example once it has been built
1617

1718
## 1 - Compile
1819
```shell script

jaeger/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# Jaeger Example
22

3-
This is a simple example that demonstrates how to use the OpenTelemetry SDK
3+
This is a simple example that demonstrates how to use the OpenTelemetry SDK
44
to instrument a simple application and export to a Jaeger backend.
55

6-
# How to run
6+
# How to Run
77

88
## Prerequisites
9-
* Java 1.8+
10-
* Docker 19.03
11-
* Jaeger 1.16 - [Link][jaeger]
129

10+
* Java 17 or higher is required to run Gradle and build this example
11+
* Java 8 or higher may be used to run the example once it has been built
12+
* Docker
13+
* Jaeger 1.16 or higher
1314

1415
## 1 - Compile
1516
```shell script

javaagent/README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,58 +3,58 @@
33
This example demonstrates simple usage of the OpenTelemetry Java Agent published
44
by [opentelemetry-java-instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation).
55

6-
It consists of a spring boot application with:
6+
It consists of a Spring Boot application with:
77

8-
- A gradle task for downloading the OpenTelemetry Java Agent.
8+
- A Gradle task for downloading the OpenTelemetry Java Agent
99
- A simple web API available at `GET http://localhost:8080/ping`. When called,
10-
auto instrumentation from the OpenTelemetry Java Agent records spans and
10+
auto-instrumentation from the OpenTelemetry Java Agent records spans and
1111
metrics. Additionally, there is manual trace and metric instrumentation, as
12-
well as application logging performed in the context of traces using the log4j
13-
API.
14-
- A docker compose setup configured to run the application and export to
15-
the [collector](https://opentelemetry.io/docs/collector/) via OTLP.
16-
- The collector is configured with
12+
well as application logging performed in the context of traces using the Log4j
13+
API
14+
- A Docker Compose setup configured to run the application and export to
15+
the [Collector](https://opentelemetry.io/docs/collector/) via OTLP
16+
- The Collector is configured with
1717
the [OTLP receiver](https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver/otlpreceiver)
18-
and export it to standard out with
18+
and exports to standard out with
1919
the [logging exporter](https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter/debugexporter)
2020

2121
## Prerequisites
2222

23-
* Java 1.8
24-
* Docker compose
23+
* Java 17 or higher is required to build and run this example
24+
* Docker Compose
2525

26-
# How to run
26+
# How to Run
2727

28-
Build the application jar
28+
Build the application jar:
2929

3030
```shell
3131
../gradlew bootJar
3232
```
3333

34-
Run the application and the collector with docker compose
34+
Run the application and the Collector with Docker Compose:
3535

3636
```shell
37-
docker-compose up --build
37+
docker compose up --build
3838
```
3939

40-
In a separate shell, exercise the application by calling its endpoint
40+
In a separate shell, exercise the application by calling its endpoint:
4141

4242
```shell
4343
curl http://localhost:8080/ping
4444
```
4545

46-
Watch for spans, metrics, and logs in the collector log output
46+
Watch for spans, metrics, and logs in the Collector log output.
4747

4848
## Declarative Configuration
4949

50-
By default, this example uses the [environment variable configuration schema](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md) to configure the SDK. However, it also includes [sdk-config.yaml](./sdk-config.yaml) which demonstrates how the [declarative configuration](https://opentelemetry.io/docs/specs/otel/configuration/#declarative-configuration) scheme can be used to configure the SDK based on a YAML configuration file instead.
50+
By default, this example uses the [environment variable configuration schema](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md) to configure the SDK. However, it also includes [sdk-config.yaml](./sdk-config.yaml) which demonstrates how the [declarative configuration](https://opentelemetry.io/docs/specs/otel/configuration/#declarative-configuration) scheme can be used to configure the SDK based on a YAML configuration file instead.
5151

5252
`sdk-config.yaml` extends the [opentelemetry-configuration sdk-config.yaml](https://github.com/open-telemetry/opentelemetry-configuration/blob/v0.3.0/examples/sdk-config.yaml) template, demonstrating:
5353

54-
- Configuration of instrumentation (see `.instrumentation.java`)
55-
- Configuration of [rule based routing sampler](https://github.com/open-telemetry/opentelemetry-java-contrib/tree/main/samplers) (see `.tracer_provider.sampler.parent_based.root`)
54+
- Configuration of instrumentation (see `.instrumentation.java`)
55+
- Configuration of [rule-based routing sampler](https://github.com/open-telemetry/opentelemetry-java-contrib/tree/main/samplers) (see `.tracer_provider.sampler.parent_based.root`)
5656

57-
To use declarative configuration instead of the environment variable scheme, add the following before starting the application and collector:
57+
To use declarative configuration instead of the environment variable scheme, add the following before starting the application and Collector:
5858

5959
```shell
6060
export OTEL_EXPERIMENTAL_CONFIG_FILE=/sdk-config.yaml

kotlin-extension/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
# Kotlin Extension examples
1+
# Kotlin Extension Examples
22

3-
This is a simple example that demonstrates how to use the Kotlin extension for attaching a Span context to a Kotlin
3+
This is a simple example that demonstrates how to use the Kotlin extension for attaching a span context to a Kotlin
44
coroutine.
55

66
## Prerequisites
77

8-
* Java 1.8 or higher
8+
* Java 17 or higher is required to run Gradle and build this example
9+
* Java 8 or higher may be used to run the example once it has been built
910

1011
## Compile
1112

12-
Compile with
13+
Compile with:
1314

1415
```shell script
1516
../gradlew shadowJar
1617
```
1718

1819
## Run
1920

20-
The following commands are used to run the examples.
21+
Use the following command to run the example:
2122

2223
```shell script
2324
java -cp build/libs/kotlin-extension-0.1.0-SNAPSHOT-all.jar io.opentelemetry.example.kotlinextension.Application

0 commit comments

Comments
 (0)