diff --git a/MiddlewareRum.podspec b/MiddlewareRum.podspec index d3e604e..ffa61b2 100644 --- a/MiddlewareRum.podspec +++ b/MiddlewareRum.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |spec| # spec.name = "MiddlewareRum" - spec.version = "2.2.3" + spec.version = "2.2.4" spec.swift_version = "5.9" spec.summary = "Middleware iOS / MacOS / tvOS real user monitoring SDK" diff --git a/Sources/MiddlewareRum/MiddlewareConstants.swift b/Sources/MiddlewareRum/MiddlewareConstants.swift index 726767d..fa0e072 100644 --- a/Sources/MiddlewareRum/MiddlewareConstants.swift +++ b/Sources/MiddlewareRum/MiddlewareConstants.swift @@ -5,7 +5,7 @@ import Foundation enum MiddlewareConstants { enum Global { static let INSTRUMENTATION_NAME = "middleware-ios" - static let VERSION_STRING = "2.2.3" + static let VERSION_STRING = "2.2.4" static let UNKNOWN_APP_NAME = "unknown-app" } diff --git a/Sources/MiddlewareRum/OpenTelemetry/Instrumentation/URLSession/URLSessionLogger.swift b/Sources/MiddlewareRum/OpenTelemetry/Instrumentation/URLSession/URLSessionLogger.swift index 4f29af6..14aec4a 100644 --- a/Sources/MiddlewareRum/OpenTelemetry/Instrumentation/URLSession/URLSessionLogger.swift +++ b/Sources/MiddlewareRum/OpenTelemetry/Instrumentation/URLSession/URLSessionLogger.swift @@ -35,26 +35,29 @@ class URLSessionLogger { var attributes = [String: AttributeValue]() - attributes[SemanticAttributes.httpMethod.rawValue] = AttributeValue.string(request.httpMethod ?? "unknown_method") + // Current HTTP semantic conventions (1.21+). This used to emit the + // deprecated http.method, http.url, http.target, net.peer.name, + // http.scheme and net.peer.port. + attributes[SemanticAttributes.httpRequestMethod.rawValue] = AttributeValue.string(request.httpMethod ?? "unknown_method") if let requestURL = request.url { - attributes[SemanticAttributes.httpUrl.rawValue] = AttributeValue.string(requestURL.absoluteString) + attributes[SemanticAttributes.urlFull.rawValue] = AttributeValue.string(requestURL.absoluteString) } if let requestURLPath = request.url?.path { - attributes[SemanticAttributes.httpTarget.rawValue] = AttributeValue.string(requestURLPath) + attributes[SemanticAttributes.urlPath.rawValue] = AttributeValue.string(requestURLPath) } if let host = request.url?.host { - attributes[SemanticAttributes.netPeerName.rawValue] = AttributeValue.string(host) + attributes[SemanticAttributes.serverAddress.rawValue] = AttributeValue.string(host) } if let requestScheme = request.url?.scheme { - attributes[SemanticAttributes.httpScheme.rawValue] = AttributeValue.string(requestScheme) + attributes[SemanticAttributes.urlScheme.rawValue] = AttributeValue.string(requestScheme) } if let port = request.url?.port { - attributes[SemanticAttributes.netPeerPort.rawValue] = AttributeValue.int(port) + attributes[SemanticAttributes.serverPort.rawValue] = AttributeValue.int(port) } if let bodySize = request.httpBody?.count { @@ -106,7 +109,7 @@ class URLSessionLogger { } let statusCode = httpResponse.statusCode - span.setAttribute(key: SemanticAttributes.httpStatusCode.rawValue, + span.setAttribute(key: SemanticAttributes.httpResponseStatusCode.rawValue, value: AttributeValue.int(statusCode)) span.status = statusForStatusCode(code: statusCode) @@ -129,7 +132,7 @@ class URLSessionLogger { guard span != nil else { return } - span.setAttribute(key: SemanticAttributes.httpStatusCode.rawValue, value: AttributeValue.int(statusCode)) + span.setAttribute(key: SemanticAttributes.httpResponseStatusCode.rawValue, value: AttributeValue.int(statusCode)) span.status = URLSessionLogger.statusForStatusCode(code: statusCode) instrumentation.configuration.receivedError?(error, dataOrFile, statusCode, span)