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

[SqlClient] For CommandType.StoredProcedure set db.operation.name and db.collection.name #2279

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
semantic conventions for
[spans](https://github.com/open-telemetry/semantic-conventions/blob/v1.28.0/docs/database/database-spans.md).
([#2229](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2229),
[#2277](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2277))
[#2277](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2277),
[#2279](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2279))
* **Breaking change**: The `peer.service` and `server.socket.address` attributes
are no longer emitted. Users should rely on the `server.address` attribute
for the same information. Note that `server.address` is only included when
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ public override void OnEventWritten(string name, object? payload)

if (this.options.EmitNewAttributes)
{
activity.SetTag(SemanticConventions.AttributeDbOperationName, "EXECUTE");
activity.SetTag(SemanticConventions.AttributeDbCollectionName, commandText);
activity.SetTag(SemanticConventions.AttributeDbQueryText, commandText);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@ internal static void VerifyActivityData(

if (emitNewAttributes)
{
Assert.Equal("EXECUTE", activity.GetTagValue(SemanticConventions.AttributeDbOperationName));
Assert.Equal(commandText, activity.GetTagValue(SemanticConventions.AttributeDbCollectionName));
Assert.Equal(commandText, activity.GetTagValue(SemanticConventions.AttributeDbQueryText));
}
}
Expand Down
Loading