HTTP client instrumentation was incorrectly putting the text representation of an HTTP status code into http.status_code. (#964)

Other changes
- HTTP 100-200 status codes should map to OK.

see https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/http.md#status
This commit is contained in:
Peter Wiese 2020-07-31 17:05:41 -07:00 committed by GitHub
parent 637874f49e
commit a3e6b0364f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -72,7 +72,7 @@ namespace OpenTelemetry.Trace
{
var newStatus = Status.Unknown;
if (httpStatusCode >= 200 && httpStatusCode <= 399)
if (httpStatusCode >= 100 && httpStatusCode <= 399)
{
newStatus = Status.Ok;
}

View File

@ -136,7 +136,7 @@ namespace OpenTelemetry.Instrumentation.Http.Implementation
if (this.stopResponseFetcher.Fetch(payload) is HttpResponseMessage response)
{
// response could be null for DNS issues, timeouts, etc...
activity.AddTag(SemanticConventions.AttributeHttpStatusCode, response.StatusCode.ToString());
activity.AddTag(SemanticConventions.AttributeHttpStatusCode, HttpTagHelper.GetStatusCodeTagValueFromHttpStatusCode(response.StatusCode));
activity.SetStatus(
SpanHelper