Skip to content

Commit

Permalink
[Instrumentation.SqlClient] Stop emitting db.statement_type attribute (
Browse files Browse the repository at this point in the history
…#5301)

Co-authored-by: Vishwesh Bankwar <[email protected]>
  • Loading branch information
Kielek and vishweshbankwar authored Feb 5, 2024
1 parent ef977c1 commit a31bca8
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* **Breaking Change**: Renamed `SqlClientInstrumentationOptions` to
`SqlClientTraceInstrumentationOptions`.
([#5285](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5285))
* **Breaking Change**: Stop emitting `db.statement_type` attribute.
([#5301](https://github.com/open-telemetry/opentelemetry-dotnet/pull/5301))

## 1.6.0-beta.3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public override void OnEventWritten(string name, object payload)
switch (commandType)
{
case CommandType.StoredProcedure:
activity.SetTag(SpanAttributeConstants.DatabaseStatementTypeKey, nameof(CommandType.StoredProcedure));
if (this.options.SetDbStatementForStoredProcedure)
{
activity.SetTag(SemanticConventions.AttributeDbStatement, (string)commandText);
Expand All @@ -117,7 +116,6 @@ public override void OnEventWritten(string name, object payload)
break;

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

case CommandType.TableDirect:
activity.SetTag(SpanAttributeConstants.DatabaseStatementTypeKey, nameof(CommandType.TableDirect));
break;
}
}
Expand Down
1 change: 0 additions & 1 deletion src/Shared/SpanAttributeConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ internal static class SpanAttributeConstants
{
public const string StatusCodeKey = "otel.status_code";
public const string StatusDescriptionKey = "otel.status_description";
public const string DatabaseStatementTypeKey = "db.statement_type";
}
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,6 @@ private static void VerifyActivityData(

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

// "db.statement_type" is never set by the SqlEventSource instrumentation
Assert.Null(activity.GetTagValue(SpanAttributeConstants.DatabaseStatementTypeKey));
if (captureText)
{
Assert.Equal(commandText, activity.GetTagValue(SemanticConventions.AttributeDbStatement));
Expand Down

0 comments on commit a31bca8

Please sign in to comment.