Connect trace context with database commands
This guide describes how to extend database telemetry with trace context propagation using OpenTelemetry for Java.
Check Compatibility and Requirements
Before enabling trace context propagation, review the required runtime, configuration, and database conditions. These prerequisites ensure that OpenTelemetry features can operate correctly and safely in your environment.
Runtime Compatibility
Trace context propagation is supported only under specific runtime conditions:
- Supported only on Java 8 or higher.
- Requires use of supported JDBC drivers.
- Applies exclusively to applications using the Oracle or Microsoft SQL Server JDBC drivers (
com.microsoft.sqlserver.jdbc.SQLServerDriverororacle.jdbc.OracleDriver).
See Requirements for Java instrumentation for full compatibility details.
Environment Variable Configuration
To enable trace context propagation for MSSQL and Oracle in Splunk OpenTelemetry Java Agent, set the following environment variable:
| Name | Default Value | Description |
|---|---|---|
OTEL_INSTRUMENTATION_SPLUNK_JDBC_ENABLED | false | Enables experimental JDBC instrumentation for MSSQL and Oracle |
To activate the feature, change the value to true.
Enable Trace Context Propagation
To activate trace context propagation:
- Confirm that your application meets the compatibility requirements listed above.
- Set the environment variable
OTEL_INSTRUMENTATION_SPLUNK_JDBC_ENABLED=true. - Attach the Splunk OpenTelemetry Java Agent to your application.
- Use a supported JDBC driver:
com.microsoft.sqlserver.jdbc.SQLServerDriver(Microsoft SQL Server).oracle.jdbc.OracleDriver(Oracle Database).
Once enabled, spans will be created for SQL commands and linked to the current trace context.