Skip to content

Commit a31bca8

Browse files
[Instrumentation.SqlClient] Stop emitting db.statement_type attribute (#5301)
Co-authored-by: Vishwesh Bankwar <vishweshbankwar@users.noreply.github.com>
1 parent ef977c1 commit a31bca8

4 files changed

Lines changed: 2 additions & 6 deletions

File tree

src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* **Breaking Change**: Renamed `SqlClientInstrumentationOptions` to
1212
`SqlClientTraceInstrumentationOptions`.
1313
([#5285](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5285))
14+
* **Breaking Change**: Stop emitting `db.statement_type` attribute.
15+
([#5301](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5301))
1416

1517
## 1.6.0-beta.3
1618

src/OpenTelemetry.Instrumentation.SqlClient/Implementation/SqlClientDiagnosticListener.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ public override void OnEventWritten(string name, object payload)
108108
switch (commandType)
109109
{
110110
case CommandType.StoredProcedure:
111-
activity.SetTag(SpanAttributeConstants.DatabaseStatementTypeKey, nameof(CommandType.StoredProcedure));
112111
if (this.options.SetDbStatementForStoredProcedure)
113112
{
114113
activity.SetTag(SemanticConventions.AttributeDbStatement, (string)commandText);
@@ -117,7 +116,6 @@ public override void OnEventWritten(string name, object payload)
117116
break;
118117

119118
case CommandType.Text:
120-
activity.SetTag(SpanAttributeConstants.DatabaseStatementTypeKey, nameof(CommandType.Text));
121119
if (this.options.SetDbStatementForText)
122120
{
123121
activity.SetTag(SemanticConventions.AttributeDbStatement, (string)commandText);
@@ -126,7 +124,6 @@ public override void OnEventWritten(string name, object payload)
126124
break;
127125

128126
case CommandType.TableDirect:
129-
activity.SetTag(SpanAttributeConstants.DatabaseStatementTypeKey, nameof(CommandType.TableDirect));
130127
break;
131128
}
132129
}

src/Shared/SpanAttributeConstants.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ internal static class SpanAttributeConstants
1212
{
1313
public const string StatusCodeKey = "otel.status_code";
1414
public const string StatusDescriptionKey = "otel.status_description";
15-
public const string DatabaseStatementTypeKey = "db.statement_type";
1615
}

test/OpenTelemetry.Instrumentation.SqlClient.Tests/SqlEventSourceTests.netfx.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,6 @@ private static void VerifyActivityData(
246246

247247
Assert.Equal("master", activity.GetTagValue(SemanticConventions.AttributeDbName));
248248

249-
// "db.statement_type" is never set by the SqlEventSource instrumentation
250-
Assert.Null(activity.GetTagValue(SpanAttributeConstants.DatabaseStatementTypeKey));
251249
if (captureText)
252250
{
253251
Assert.Equal(commandText, activity.GetTagValue(SemanticConventions.AttributeDbStatement));

0 commit comments

Comments
 (0)