Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 5 additions & 0 deletions src/OpenTelemetry.Instrumentation.SqlClient/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

* Updated to use Activity native support from `System.Diagnostics.DiagnosticSource`
to set activity status.
([#3118](https://github.com/open-telemetry/opentelemetry-dotnet/issues/3118))
([#3751](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3751))

## 1.0.0-rc9.7

Released 2022-Sep-29
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public override void OnEventWritten(string name, object payload)
{
if (activity.IsAllDataRequested)
{
activity.SetStatus(Status.Unset);
activity.SetStatus(ActivityStatusCode.Unset);
}
}
finally
Expand Down Expand Up @@ -180,7 +180,7 @@ public override void OnEventWritten(string name, object payload)
{
if (this.exceptionFetcher.TryFetch(payload, out Exception exception) && exception != null)
{
activity.SetStatus(Status.Error.WithDescription(exception.Message));
activity.SetStatus(ActivityStatusCode.Error, exception.Message);

if (this.options.RecordException)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,16 @@ private void OnEndExecute(EventWrittenEventArgs eventData)
int compositeState = (int)eventData.Payload[1];
if ((compositeState & 0b001) == 0b001)
{
activity.SetStatus(Status.Unset);
activity.SetStatus(ActivityStatusCode.Unset);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont need this either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed it, too; thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its still here.... :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
else if ((compositeState & 0b010) == 0b010)
{
var errorText = $"SqlExceptionNumber {eventData.Payload[2]} thrown.";
activity.SetStatus(Status.Error.WithDescription(errorText));
activity.SetStatus(ActivityStatusCode.Error, errorText);
}
else
{
activity.SetStatus(Status.Error.WithDescription("Unknown Sql failure."));
activity.SetStatus(ActivityStatusCode.Error, "Unknown Sql failure.");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,13 @@ private static void VerifyActivityData(

if (!isFailure)
{
Assert.Equal(Status.Unset, activity.GetStatus());
Assert.Equal(ActivityStatusCode.Unset, activity.Status);
}
else
{
var status = activity.GetStatus();
Assert.Equal(Status.Error.StatusCode, status.StatusCode);
Assert.NotNull(status.Description);
Assert.Equal(ActivityStatusCode.Error, activity.Status);
Assert.NotNull(activity.StatusDescription);

if (recordException)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,12 @@ private static void VerifyActivityData(

if (!isFailure)
{
Assert.Equal(Status.Unset, activity.GetStatus());
Assert.Equal(ActivityStatusCode.Unset, activity.Status);
}
else
{
var status = activity.GetStatus();
Assert.Equal(Status.Error.StatusCode, status.StatusCode);
Assert.NotNull(status.Description);
Assert.Equal(ActivityStatusCode.Error, activity.Status);
Assert.NotNull(activity.StatusDescription);
}
}

Expand Down