Skip to content

Commit

Permalink
Http Span Status - Default to Unset if not in range defined by spec (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
vishweshbankwar authored Nov 17, 2023
1 parent 68eabf0 commit 0256f87
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Shared/SpanHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ internal static class SpanHelper
/// <returns>Resolved span <see cref="Status"/> for the Http status code.</returns>
public static ActivityStatusCode ResolveSpanStatusForHttpStatusCode(ActivityKind kind, int httpStatusCode)
{
var upperBound = kind == ActivityKind.Client ? 399 : 499;
if (httpStatusCode >= 100 && httpStatusCode <= upperBound)
var lowerBound = kind == ActivityKind.Client ? 400 : 500;
var upperBound = 599;
if (httpStatusCode >= lowerBound && httpStatusCode <= upperBound)
{
return ActivityStatusCode.Unset;
return ActivityStatusCode.Error;
}

return ActivityStatusCode.Error;
return ActivityStatusCode.Unset;
}
}

0 comments on commit 0256f87

Please sign in to comment.