From e376aef472468666cc5d9dbaaab60dc1757293b7 Mon Sep 17 00:00:00 2001 From: Vishwesh Bankwar Date: Tue, 29 Nov 2022 10:46:25 -0800 Subject: [PATCH] [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 * resolve PR comments Co-authored-by: Timothy Mothra Co-authored-by: Mikel Blanchard --- src/OpenTelemetry.Instrumentation.SqlClient/README.md | 5 +++++ .../SqlClientInstrumentationOptions.cs | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/README.md b/src/OpenTelemetry.Instrumentation.SqlClient/README.md index 7d20c1976..af4a11741 100644 --- a/src/OpenTelemetry.Instrumentation.SqlClient/README.md +++ b/src/OpenTelemetry.Instrumentation.SqlClient/README.md @@ -142,6 +142,11 @@ using var tracerProvider = Sdk.CreateTracerProviderBuilder() .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 **Note:** EnableConnectionLevelAttributes is supported on all runtimes. diff --git a/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientInstrumentationOptions.cs b/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientInstrumentationOptions.cs index 6cfb81a95..121fed50b 100644 --- a/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientInstrumentationOptions.cs +++ b/src/OpenTelemetry.Instrumentation.SqlClient/SqlClientInstrumentationOptions.cs @@ -94,9 +94,15 @@ namespace OpenTelemetry.Instrumentation.SqlClient /// On .NET and .NET Core SetDbStatementForText only applies to /// SqlCommands with . /// On .NET Framework SetDbStatementForText applies to all - /// SqlCommands regardless of . Use + /// SqlCommands regardless of . + /// + /// When using System.Data.SqlClient use + /// SetDbStatementForText to capture StoredProcedure command + /// names. + /// When using Microsoft.Data.SqlClient use /// SetDbStatementForText to capture Text, StoredProcedure, and all /// other command text. + /// /// /// ///