Http Span Status - Default to Unset if not in range defined by spec (#5060)
This commit is contained in:
parent
68eabf0188
commit
0256f875d4
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue