Skip to content

A demo spring boot application with grafana stack and otel for observability

Notifications You must be signed in to change notification settings

vineethvijay7/spring-boot-observability

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java spring boot app with OpenTelemetry (OTEL) and Grafana stack

To run OpenTelemetry (OTEL) collector to send observability data from a Java spring boot app to Grafana stack.

Check Spring Boot app/ directory for more details on the demo app.

OpenTelemetry for Java

There are different ways to collect observability data out of your java applicaion. Refer : https://opentelemetry.io/docs/languages/java/#repositories

We are using the https://github.com/open-telemetry/opentelemetry-java-instrumentation java agent method.

Get OpenTelemetry Java Agent

First, download the OpenTelemetry Java agent:

## get latest when possible (test it first, ofcourse)

cd examples/java/spring-boot/etc/
wget -q -O ./opentelemetry-javaagent.jar https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.4.0/opentelemetry-javaagent.jar

Build the java app

# Pre-req: you need to have `sdk`: https://sdkman.io/install. 
# Again this is upto you. If you have the correct java runtime already, feel free to move to the build part.
sdk use java 17.0.9-tem # to select correct java runtime

## Build the jar using gradle. You can use maven if you want, then the path to the jar needs to be updated in the Dockerfile
./gradlew bootJar

Run Docker Compose

Next, run the Docker Compose file with the following commands:

For full stack on local

docker compose up --remove-orphans

Endpoints for full local stack

Loki: See Logs

Tempo: See Traces

Prometheus: See Metrics


Cleanup

docker-compose down --remove-orphans

docker volume rm otel_grafana-storage otel_loki-storage otel_mimir-storage otel_minio-data otel_prometheus-data otel_tempo-storage

About

A demo spring boot application with grafana stack and otel for observability

Resources

Stars

Watchers

Forks

Packages

No packages published