This example demonstrates simple usage of the OpenTelemetry Java Agent published by opentelemetry-java-instrumentation.
It consists of a spring boot application with:
- A gradle task for downloading the OpenTelemetry Java Agent.
- A simple web API available at
GET http://localhost:8080/ping
. When called, auto instrumentation from the OpenTelemetry Java Agent records spans and metrics. Additionally, there is manual trace and metric instrumentation, as well as application logging performed in the context of traces using the log4j API. - A docker compose setup configured to run the application and export to the collector via OTLP.
- The collector is configured with the OTLP receiver and export it to standard out with the logging exporter
- Java 1.8
- Docker compose
Build the application jar
../gradlew bootJar
Run the application and the collector with docker compose
docker-compose up --build
In a separate shell, exercise the application by calling its endpoint
curl http://localhost:8080/ping
Watch for spans, metrics, and logs in the collector log output