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

[bug] SqlClient Instrumentation cannot get CommandText #2287

Open
Robert-Chan opened this issue Nov 2, 2024 · 1 comment
Open

[bug] SqlClient Instrumentation cannot get CommandText #2287

Robert-Chan opened this issue Nov 2, 2024 · 1 comment
Labels
bug Something isn't working comp:instrumentation.sqlclient Things related to OpenTelemetry.Instrumentation.SqlClient

Comments

@Robert-Chan
Copy link

Component

OpenTelemetry.Instrumentation.SqlClient

Package Version

Package Name Version
OpenTelemetry.Api 1.9.0
OpenTelemetry 1.9.0
OpenTelemetry 1.9.0-beta.1

Runtime Version

net48

Description

I hava dubuged the source code of OpenTelemetry.Instrumentation.SqlClient.
Got dasource,database, but no commandText. We use EntityFramework6.
image

Steps to Reproduce

As description

Expected Result

Get SQL statement and send to telemetry endpoint

Actual Result

cannot get sql CommandText

Additional Context

No response

@Robert-Chan Robert-Chan added the bug Something isn't working label Nov 2, 2024
@github-actions github-actions bot added the comp:instrumentation.sqlclient Things related to OpenTelemetry.Instrumentation.SqlClient label Nov 2, 2024
@adamratson
Copy link

Hey, I ran into a similar issue recently - I found by using Microsoft.Data.SqlClient instead I got the full command text.

There is a note in the README that implies that command text is not available using System.Data.SqlClient

When using the built-in System.Data.SqlClient only stored procedure command names will ever be captured. When using the Microsoft.Data.SqlClient NuGet package (v1.1+) stored procedure command names, full query text, and other command text will be captured.

(Last note under this section https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/main/src/OpenTelemetry.Instrumentation.SqlClient/README.md)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working comp:instrumentation.sqlclient Things related to OpenTelemetry.Instrumentation.SqlClient
Projects
None yet
Development

No branches or pull requests

2 participants