Skip to content

Latest commit

 

History

History
69 lines (46 loc) · 2.05 KB

File metadata and controls

69 lines (46 loc) · 2.05 KB
name spring-boot-jdbc-tracing
description Spring Boot sample for Oracle JDBC tracing with OpenTelemetry.
tags
Database
Java
JDBC
Observability
SpringBoot
blog_post https://andersswanson.dev/2025/10/10/oracle-jdbc-tracing-with-spring-boot-opentelemetry/

Spring Boot Oracle AI Database JDBC Tracing

This example application demonstrates how to instrument Oracle AI Database JDBC connections from a Spring Boot app context with OpenTelemetry.

References

Prerequisites

  • Java 21+, Maven
  • Docker compatible environment with docker-compose

Setup Oracle AI Database Free and Grafana LGTM with docker-compose

Start the Oracle AI Database Free and Zipkin containers with docker-compose:

docker-compose -d

When the database starts, the grant_permissions.sql is run, creating a test user and a table.

Run the sample

This command starts the Java application:

mvn spring-boot:run

Create a trace

POST to the app's REST API to create a trace, starting with a span for the HTTP invocation that drops into the JDBC/database layer:

curl -X POST http://localhost:8080/flavors \
  -H "Content-Type: application/json" \
  -d '{"flavor": "Mint Chocolate Chip"}'

View traces

  1. Navigate to the Grafana Tracing UI, using the container URL http://localhost:3000/a/grafana-exploretraces-app
  2. Click "Traces" to find all traces, or search for a specific trace ID
  3. View the trace! You can see HTTP request down to database query from a single trace

Configure OJDBC Tracing System Properties

oracle.jdbc.provider.opentelemetry.enabled

Set this property to true to enable the provider. Enabled by default.

oracle.jdbc.provider.opentelemetry.sensitive-enabled

Set this property to true to export sensitive data, like SQL query text. Disabled by default.