Correlate database queries with Java traces
- If your Java application is uninstrumented, instrument it to send spans to Splunk APM.
- Configure the Java agent as needed.
This configuration must include the environment variable
OTEL_INSTRUMENTATION_SPLUNK_JDBC_ENABLEDset totrue.-
Example of setting the environment variable at the command line:
CODEexport OTEL_INSTRUMENTATION_SPLUNK_JDBC_ENABLED=true -
Example Kubernetes deployment snippet:
YAMLapiVersion: apps/v1 kind: Deployment spec: selector: matchLabels: app: your-application template: spec: containers: - name: myapp env: - ... - name: OTEL_INSTRUMENTATION_SPLUNK_JDBC_ENABLED value: "true"
-
- Run the Java agent with the appended
-javaagentoption to enable instrumentation.CODEjava -javaagent:/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar -jar data-ecosystem-java-app-1.0-SNAPSHOT.jar