Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate trace info to the database from SQL query text #11940

Open
igor-suhorukov opened this issue Aug 3, 2024 · 2 comments
Open

Propagate trace info to the database from SQL query text #11940

igor-suhorukov opened this issue Aug 3, 2024 · 2 comments
Labels
contribution welcome Request makes sense, maintainers probably won't have time, contribution would be welcome enhancement New feature or request

Comments

@igor-suhorukov
Copy link
Contributor

Is your feature request related to a problem? Please describe.

When tracing an application and troubleshooting application issues, it is often useful to trace a SQL query from the application in the database logs. This allows you to move from a query to its plan and understand why the DBMS acts in this way in a particular case. Some cloud solutions allow such tracing to the database level, distributing the tracing context as a comment in the SQL query. It would be useful to implement similar functionality in Opentelemetry java agent JDBC

Describe the solution you'd like

When running my application with the opentelemetry agent and the agent option to tracing in the SQL text enabled (some new experimental option), I expect in the logs of my DBMS something similar to:

SELECT * FROM nodes /*service.name='MyJavaApp',traceparent='00-00000000000000007fffffffffffffff-000000025cb0161a-00'*

There is already an implementation of such functionality in the project

Describe alternatives you've considered

Save session information from JDBC Connection in tracing object io.opentelemetry.instrumentation.jdbc.internal.DbRequest

Additional context

No response

@igor-suhorukov igor-suhorukov added enhancement New feature or request needs triage New issue that requires triage labels Aug 3, 2024
@trask
Copy link
Member

trask commented Sep 27, 2024

We'd welcome a contribution for this.

SQLCommenter was donated to OpenTelemetry but integration into the Java instrumentation project never happened: open-telemetry/opentelemetry-java-contrib#205 (comment)

@trask trask added contribution welcome Request makes sense, maintainers probably won't have time, contribution would be welcome and removed needs triage New issue that requires triage labels Sep 27, 2024
@jackgopack4
Copy link

This would be very helpful, at a bare minimum if opentelemetry-sqlcommenter could be integrated as a package in opentelemetry-java-contrib like mentioned above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome Request makes sense, maintainers probably won't have time, contribution would be welcome enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants