opentelemetry-java-instrumentation icon indicating copy to clipboard operation
opentelemetry-java-instrumentation copied to clipboard

Instrumentation for JDBC transaction commits

Open zhenlin-pay2 opened this issue 1 year ago • 1 comments

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

For the database we are using in our application, SQL COMMIT commands can take as long as typical DML commands (SELECT, INSERT, UPDATE, DELETE) to execute, and in edge cases, even longer, so we need visibility into when and how long COMMIT commands are running, especially in individual traces but perhaps also in aggregate.

Describe the solution you'd like

We would like to have instrumentation for COMMIT of a similar nature to the instrumentation already provided for DML commands. For JDBC this entails adding instrumentation to the commit method of java.sql.Connection.

Describe alternatives you've considered

We tried adding java.sql.Connection[commit] to otel.instrumentation.methods.include but the results were unsatisfactory for our setup: there were two layers of proxy objects, so each COMMIT resulted in three (nested) spans in the trace.

Additional context

For symmetry, it might also be nice to have instrumentation for ROLLBACK (java.sql.Connection[rollback]) too.

zhenlin-pay2 avatar Feb 02 '24 04:02 zhenlin-pay2

I try to contribute for this issue in the PR #11517 . So please check it.

tkmsaaaam avatar Jun 02 '24 11:06 tkmsaaaam