Skip to content

[feature request] SqlClient Spans Should Always Capture Comments in db.statement #2795

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

Open
RogueMaurice opened this issue May 16, 2025 · 2 comments
Labels
comp:instrumentation.sqlclient Things related to OpenTelemetry.Instrumentation.SqlClient enhancement New feature or request

Comments

@RogueMaurice
Copy link

Component

OpenTelemetry.Instrumentation.SqlClient

Is your feature request related to a problem?

When using .NET 9 and EntityFrameworkCore, command text recorded in traces does not include comments add via DbCommandInterceptor.

What is the expected behavior?

When using .Net Framework 4.8 and EntityFramework6 command text recorded in traces shows comments added via DbCommandInterceptor.

I would like to have the full command text (minus whatever is redacted) available in every runtime that is supported by SqlClient or EntityFrameworkCore instrumentation.

Which alternative solutions or features have you considered?

None.

Additional context

No response

@RogueMaurice RogueMaurice added the enhancement New feature or request label May 16, 2025
@github-actions github-actions bot added the comp:instrumentation.sqlclient Things related to OpenTelemetry.Instrumentation.SqlClient label May 16, 2025
@wss-rbrennan
Copy link

@RogueMaurice
Copy link
Author

RogueMaurice commented Jun 9, 2025

When opting into the new semantics, db.query.text still does not display any comments. It appears that the command text is captured before code from any EF DbCommandInterceptor is executed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:instrumentation.sqlclient Things related to OpenTelemetry.Instrumentation.SqlClient enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants