[SqlClient] Clarify behavior when using `System.Data.SqlClient` with .NET Framework (#3937)

* Add System.Data.SqlClient clarification for netfmk

* wrap comment

* readme update

* readme

* Update src/OpenTelemetry.Instrumentation.SqlClient/README.md

Co-authored-by: Timothy Mothra <tilee@microsoft.com>

* resolve PR comments

Co-authored-by: Timothy Mothra <tilee@microsoft.com>
Co-authored-by: Mikel Blanchard <mblanchard@macrosssoftware.com>
This commit is contained in:
Vishwesh Bankwar 2022-11-29 10:46:25 -08:00 committed by GitHub
parent 6c73e36808
commit e376aef472
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -142,6 +142,11 @@ using var tracerProvider = Sdk.CreateTracerProviderBuilder()
.Build(); .Build();
``` ```
**Note:** 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.
### EnableConnectionLevelAttributes ### EnableConnectionLevelAttributes
**Note:** EnableConnectionLevelAttributes is supported on all runtimes. **Note:** EnableConnectionLevelAttributes is supported on all runtimes.

View File

@ -94,9 +94,15 @@ namespace OpenTelemetry.Instrumentation.SqlClient
/// <item>On .NET and .NET Core SetDbStatementForText only applies to /// <item>On .NET and .NET Core SetDbStatementForText only applies to
/// <c>SqlCommand</c>s with <see cref="CommandType.Text"/>.</item> /// <c>SqlCommand</c>s with <see cref="CommandType.Text"/>.</item>
/// <item>On .NET Framework SetDbStatementForText applies to all /// <item>On .NET Framework SetDbStatementForText applies to all
/// <c>SqlCommand</c>s regardless of <see cref="CommandType"/>. Use /// <c>SqlCommand</c>s regardless of <see cref="CommandType"/>.
/// <list type="bullet">
/// <item>When using <c>System.Data.SqlClient</c> use
/// SetDbStatementForText to capture StoredProcedure command
/// names.</item>
/// <item>When using <c>Microsoft.Data.SqlClient</c> use
/// SetDbStatementForText to capture Text, StoredProcedure, and all /// SetDbStatementForText to capture Text, StoredProcedure, and all
/// other command text.</item> /// other command text.</item>
/// </list></item>
/// </list> /// </list>
/// </para> /// </para>
/// </remarks> /// </remarks>