ActivityExtensions.SetStatus vs Activity.Status #4703
Replies: 2 comments
-
@jamescrosswell If you are using the latest stable version of SDK, you can simply call |
Beta Was this translation helpful? Give feedback.
-
Thanks @vishweshbankwar... that makes sense. Maybe worth adding an |
Beta Was this translation helpful? Give feedback.
-
The docs for ActivityExtensions.SetStatus indicate:
And the implementation for that extension method just sets a couple of otel tags on the activity:
There is an
Activity.Status
property in .NET 7.This is a bit confusing. The
Activity.Status
of the span/activity that you get from the following code isActivityStatusCode.Unset
... not what you'd expect:Is this because the
Activity
class on older versions of the .NET Framework didn't have aStatus
field?I wonder if it makes sense to augment the implementation of
ActivityExtensions.SetStatus
with something like:ToActivityStatusCode
could probably be avoided by writing an implicit conversion operator forOpenTelemetry.Trace.Status
.Beta Was this translation helpful? Give feedback.
All reactions