diff --git a/src/http/httpClient/HttpClientRequestAdapter.cs b/src/http/httpClient/HttpClientRequestAdapter.cs index 4ec4906..05314d5 100644 --- a/src/http/httpClient/HttpClientRequestAdapter.cs +++ b/src/http/httpClient/HttpClientRequestAdapter.cs @@ -78,7 +78,7 @@ public string? BaseUrl var decodedUriTemplate = ParametersNameDecodingHandler.DecodeUriEncodedString(requestInfo.UrlTemplate, charactersToDecodeForUriTemplate); var telemetryPathValue = string.IsNullOrEmpty(decodedUriTemplate) ? string.Empty : queryParametersCleanupRegex.Replace(decodedUriTemplate, string.Empty); var span = activitySource?.StartActivity($"{methodName} - {telemetryPathValue}"); - span?.SetTag("http.uri_template", decodedUriTemplate); + span?.SetTag("url.uri_template", decodedUriTemplate); return span; } /// @@ -519,7 +519,7 @@ private async Task GetHttpResponseMessageAsync(RequestInfor using var contentLengthEnumerator = contentLengthValues.GetEnumerator(); if(contentLengthEnumerator.MoveNext() && int.TryParse(contentLengthEnumerator.Current, out var contentLength)) { - activityForAttributes?.SetTag("http.response_content_length", contentLength); + activityForAttributes?.SetTag("http.response.body.size", contentLength); } } if(response.Headers.TryGetValues("Content-Type", out var contentTypeValues)) @@ -527,11 +527,11 @@ private async Task GetHttpResponseMessageAsync(RequestInfor using var contentTypeEnumerator = contentTypeValues.GetEnumerator(); if(contentTypeEnumerator.MoveNext()) { - activityForAttributes?.SetTag("http.response_content_type", contentTypeEnumerator.Current); + activityForAttributes?.SetTag("http.response.header.content-type", contentTypeEnumerator.Current); } } - activityForAttributes?.SetTag("http.status_code", (int)response.StatusCode); - activityForAttributes?.SetTag("http.flavor", $"{response.Version.Major}.{response.Version.Minor}"); + activityForAttributes?.SetTag("http.response.status_code", (int)response.StatusCode); + activityForAttributes?.SetTag("network.protocol.name", $"{response.Version.Major}.{response.Version.Minor}"); return await RetryCAEResponseIfRequiredAsync(response, requestInfo, cancellationToken, claims, activityForAttributes).ConfigureAwait(false); } @@ -612,12 +612,12 @@ private HttpRequestMessage GetRequestMessageFromRequestInformation(RequestInform { using var span = activitySource?.StartActivity(nameof(GetRequestMessageFromRequestInformation)); SetBaseUrlForRequestInformation(requestInfo);// this method can also be called from a different context so ensure the baseUrl is added. - activityForAttributes?.SetTag("http.method", requestInfo.HttpMethod.ToString()); + activityForAttributes?.SetTag("http.request.method", requestInfo.HttpMethod.ToString()); var requestUri = requestInfo.URI; - activityForAttributes?.SetTag("http.host", requestUri.Host); - activityForAttributes?.SetTag("http.scheme", requestUri.Scheme); + activityForAttributes?.SetTag("url.scheme", requestUri.Host); + activityForAttributes?.SetTag("server.address", requestUri.Scheme); if(obsOptions.IncludeEUIIAttributes) - activityForAttributes?.SetTag("http.uri", requestUri.ToString()); + activityForAttributes?.SetTag("url.full", requestUri.ToString()); var message = new HttpRequestMessage { Method = new HttpMethod(requestInfo.HttpMethod.ToString().ToUpperInvariant()), @@ -653,13 +653,13 @@ private HttpRequestMessage GetRequestMessageFromRequestInformation(RequestInform { var contentLenEnumerator = contentLenValues.GetEnumerator(); if(contentLenEnumerator.MoveNext() && int.TryParse(contentLenEnumerator.Current, out var contentLenValueInt)) - activityForAttributes?.SetTag("http.request_content_length", contentLenValueInt); + activityForAttributes?.SetTag("http.request.body.size", contentLenValueInt); } if(message.Content.Headers.TryGetValues("Content-Type", out var contentTypeValues)) { var contentTypeEnumerator = contentTypeValues.GetEnumerator(); if(contentTypeEnumerator.MoveNext()) - activityForAttributes?.SetTag("http.request_content_type", contentTypeEnumerator.Current); + activityForAttributes?.SetTag("http.request.header.content-type", contentTypeEnumerator.Current); } } return message; diff --git a/src/http/httpClient/Middleware/RedirectHandler.cs b/src/http/httpClient/Middleware/RedirectHandler.cs index 07cc871..2c4d37f 100644 --- a/src/http/httpClient/Middleware/RedirectHandler.cs +++ b/src/http/httpClient/Middleware/RedirectHandler.cs @@ -82,7 +82,7 @@ protected override async Task SendAsync(HttpRequestMessage { using var redirectActivity = activitySource?.StartActivity($"{nameof(RedirectHandler)}_{nameof(SendAsync)} - redirect {redirectCount}"); redirectActivity?.SetTag("com.microsoft.kiota.handler.redirect.count", redirectCount); - redirectActivity?.SetTag("http.status_code", response.StatusCode); + redirectActivity?.SetTag("http.response.status_code", response.StatusCode); // Drain response content to free responses. if(response.Content != null) { diff --git a/src/http/httpClient/Middleware/RetryHandler.cs b/src/http/httpClient/Middleware/RetryHandler.cs index 4c1d1da..4bed641 100644 --- a/src/http/httpClient/Middleware/RetryHandler.cs +++ b/src/http/httpClient/Middleware/RetryHandler.cs @@ -106,7 +106,7 @@ private async Task SendRetryAsync(HttpResponseMessage respo exceptions.Add(await GetInnerExceptionAsync(response).ConfigureAwait(false)); using var retryActivity = activitySource?.StartActivity($"{nameof(RetryHandler)}_{nameof(SendAsync)} - attempt {retryCount}"); retryActivity?.SetTag("http.retry_count", retryCount); - retryActivity?.SetTag("http.status_code", response.StatusCode); + retryActivity?.SetTag("http.response.status_code", response.StatusCode); // Call Delay method to get delay time from response's Retry-After header or by exponential backoff Task delay = RetryHandler.DelayAsync(response, retryCount, retryOption.Delay, out double delayInSeconds, cancellationToken);