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

Fix JDBC instrumentation: recursive statements inside Connection#getMetaData #2756

Conversation

mateuszrzeszutek
Copy link
Member

Fixes #2644

The recursive Statement call happens before we start the CLIENT span (DbInfo dbInfo = extractDbInfo(connection)), so the shouldStartSpan() cannot prevent this - it's too late.

Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a test for prepared statement too? just because this feels fragile (and an important fix 👍)

@trask trask merged commit 5c280d4 into open-telemetry:main Apr 9, 2021
@mateuszrzeszutek mateuszrzeszutek deleted the fix-jdbc-instrumentation-recursive-statements branch April 12, 2021 07:56
@marcobjorge
Copy link

marcobjorge commented Dec 15, 2021

Hi @mateuszrzeszutek ,

With this fix if we have multi-layer JDBC driver we are never able to capture traces from the innermost layers (e.g. using Apache Calcite with underlying MySQL). Any ideias how we can work around it, even if as a workaround?

For example, could we do CallDepth.forClass(statement.getClass()); instead of CallDepth.forClass(Statement.class);?

Thanks,

@iNikem
Copy link
Contributor

iNikem commented Dec 16, 2021

@marcobjorge can you please open a new issue for this? Otherwise it will be lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Agent instrumentation fails on sybase jdbc instrumentation
5 participants