public static Status GetStatus(this Activity activity) { Debug.Assert(activity != null, "Activity should not be null"); ActivityStatusTagEnumerator state = default; ActivityTagsEnumeratorFactory <ActivityStatusTagEnumerator> .Enumerate(activity, ref state); if (!state.IsValid) { return(default);
public static Status GetStatus(this Activity activity) { Debug.Assert(activity != null, "Activity should not be null"); ActivityStatusTagEnumerator state = default; ActivityTagObjectsEnumeratorFactory <ActivityStatusTagEnumerator> .Enumerate(activity, ref state); var status = SpanHelper.ResolveCanonicalCodeToStatus(state.StatusCode); if (status.IsValid && !string.IsNullOrEmpty(state.StatusDescription)) { return(status.WithDescription(state.StatusDescription)); } return(status); }
public static bool TryGetStatus(this Activity activity, out StatusCode statusCode, out string statusDescription) { Debug.Assert(activity != null, "Activity should not be null"); ActivityStatusTagEnumerator state = default; ActivityTagsEnumeratorFactory <ActivityStatusTagEnumerator> .Enumerate(activity, ref state); if (!state.StatusCode.HasValue) { statusCode = default; statusDescription = null; return(false); } statusCode = state.StatusCode.Value; statusDescription = state.StatusDescription; return(true); }