From 21d5b8ce932960b3cf0498a91c888d72375353fa Mon Sep 17 00:00:00 2001 From: Ignacio Bonafonte Date: Thu, 28 Sep 2023 21:32:48 +0200 Subject: [PATCH] Use an API supported in older system versions --- Sources/Instrumentation/URLSession/URLSessionLogger.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Instrumentation/URLSession/URLSessionLogger.swift b/Sources/Instrumentation/URLSession/URLSessionLogger.swift index 09e2a5c9..3c4e291e 100644 --- a/Sources/Instrumentation/URLSession/URLSessionLogger.swift +++ b/Sources/Instrumentation/URLSession/URLSessionLogger.swift @@ -115,7 +115,7 @@ class URLSessionLogger { value: AttributeValue.int(statusCode)) span.status = statusForStatusCode(code: statusCode) - if let contentLengthHeader = httpResponse.value(forHTTPHeaderField: "Content-Length"), + if let contentLengthHeader = httpResponse.allHeaderFields["Content-Length"] as? String, let contentLength = Int(contentLengthHeader) { span.setAttribute(key: SemanticAttributes.httpResponseBodySize.rawValue, value: AttributeValue.int(contentLength))