Spring Boot OTLP Integration
Instrument a Spring Boot app with the OpenTelemetry Java Agent for zero-code tracing and metrics, exported to DataBuff over OTLP.
Best for existing Spring Boot projects that need minimal code changes. For general OTLP details, see OpenTelemetry OTLP Ingestion.
Prerequisites
- A Spring Boot app on JDK 8+ (runnable JAR or local
spring-boot:run) - DataBuff deployed and reachable from the app process on the OTLP ports
1. Start DataBuff
Follow Docker Installation. After install, the terminal prints endpoints. Defaults:
| Purpose | Address |
|---|---|
| Web UI | http://<host-ip>:27403 |
| Default login | admin / Databuff@123 |
| OTLP gRPC | <host-ip>:4317 |
| OTLP HTTP | http://<host-ip>:4318 |
Replace <ingest-host> below with the Ingest hostname or IP (usually localhost or 127.0.0.1 for local Docker).
2. Download the OpenTelemetry Java Agent
Download opentelemetry-javaagent.jar from OpenTelemetry Java Instrumentation Releases and place it where your app can load it, e.g. the project root:
curl -L -o opentelemetry-javaagent.jar \
https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jarThe agent auto-instruments Spring MVC, WebFlux, JDBC, Kafka, and other common libraries without code changes.
3. Configure the Spring Boot App
application.yml (recommended)
The agent uses spring.application.name as the default service name when OTEL_SERVICE_NAME is unset:
spring:
application:
name: my-spring-serviceEquivalent application.properties:
spring.application.name=my-spring-serviceOTLP export (environment variables)
Set these before starting the app; replace <ingest-host> with your Ingest address:
export OTEL_SERVICE_NAME=my-spring-service
export OTEL_TRACES_EXPORTER=otlp
export OTEL_METRICS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_ENDPOINT="http://<ingest-host>:4318"
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobufFor gRPC:
export OTEL_EXPORTER_OTLP_ENDPOINT="http://<ingest-host>:4317"
export OTEL_EXPORTER_OTLP_PROTOCOL=grpcTip: Use
localhostwhen Spring Boot and DataBuff run on the same host. When the app runs in a container and DataBuff on the host, use the host IP orhost.docker.internal(macOS / Windows Docker Desktop).
4. Start the App with the Java Agent
Run a JAR
java -javaagent:./opentelemetry-javaagent.jar \
-jar target/my-spring-service.jarMaven local development
./mvnw spring-boot:run \
-Dspring-boot.run.jvmArguments="-javaagent:./opentelemetry-javaagent.jar"JVM system properties instead of env vars
java -javaagent:./opentelemetry-javaagent.jar \
-Dotel.service.name=my-spring-service \
-Dotel.exporter.otlp.endpoint=http://<ingest-host>:4318 \
-Dotel.exporter.otlp.protocol=http/protobuf \
-Dotel.traces.exporter=otlp \
-Dotel.metrics.exporter=otlp \
-jar target/my-spring-service.jarHit a few HTTP endpoints (e.g. /actuator/health or your APIs) to generate traces and metrics.
5. Verify in the DataBuff UI
- Open the Web UI at
http://<ingest-host>:27403and sign in with the default account - Go to Application Performance → Services and confirm
my-spring-service(or yourOTEL_SERVICE_NAME) appears - Open Application Performance → Traces and inspect traces from your requests
- On the service detail page, review JVM / HTTP metric charts
If nothing shows up, check Ingest connectivity, service name, and app logs for OTLP export errors. See OpenTelemetry OTLP Ingestion for more.
Optional: sampling and export interval
For production, tune sampling and metric export via environment variables (see Performance Tuning):
export OTEL_TRACES_SAMPLER=parentbased_traceidratio
export OTEL_TRACES_SAMPLER_ARG=0.1 # ~10% of traces
export OTEL_METRIC_EXPORT_INTERVAL=60000 # export metrics every 60s