open-telemetry / opentelemetry-java-instrumentation

OpenTelemetry auto-instrumentation and instrumentation libraries for Java
https://opentelemetry.io
Apache License 2.0
1.81k stars 795 forks source link

SQL Query Parameters Not Captured in OpenTelemetry Java Agent #11724

Closed sstglobal closed 2 weeks ago

sstglobal commented 2 weeks ago

Describe the bug

SQL query parameters are not being captured when using the OpenTelemetry Java agent version 2.4.0 with Spring Boot and Hibernate.

Steps to reproduce

Steps to Reproduce

  1. Set up a Spring Boot application with the following dependencies:

    • spring-boot-starter-data-jpa
    • oracle-ojdbc8
    • opentelemetry-javaagent
  2. Configure the application properties:

    spring.datasource.jndi-name=jdbc/test
    spring.jpa.database-platform=org.hibernate.dialect.Oracle12cDialect
    spring.jpa.show-sql=true
    spring.jpa.properties.hibernate.format_sql=true
    logging.level.org.hibernate.SQL=DEBUG
    logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
  3. Start the application with the OpenTelemetry Java agent:

    java -javaagent:/path/to/opentelemetry-javaagent.jar \
         -Dotel.exporter.otlp.endpoint=http://tempo:4317 \
         -Dotel.service.name=dev \
         -Dotel.exporter.otlp.protocol=grpc \
         -Dotel.instrumentation.jdbc.capture-parameters=true \
         -Dotel.javaagent.debug=true \
         -jar your-application.jar
  4. Execute a SQL query using JPA.

Expected behavior

SQL query parameters should be captured and logged in Tempo.

Actual behavior

SQL query parameters are not being captured.

Javaagent or library instrumentation version

2.4.0

Environment

Additional context

No response

laurit commented 2 weeks ago

Duplicate of https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7413

sstglobal commented 1 week ago

@laurit This issue is not resolved when hosting the application on Oracle WebLogic Server.

laurit commented 1 week ago

This issue is not resolved when hosting the application on Oracle WebLogic Server.

@sstglobal this issue is duplicate of issue #7413