Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MiddlewareRum.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion Sources/MiddlewareRum/MiddlewareConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,29 @@

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 {
Expand Down Expand Up @@ -106,7 +109,7 @@
}

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)

Expand All @@ -129,7 +132,7 @@
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)

Expand All @@ -153,7 +156,7 @@
}
instrumentation.configuration.injectCustomHeaders?(&request, span)
var instrumentedRequest = request
objc_setAssociatedObject(instrumentedRequest, &URLSessionInstrumentation.instrumentedKey, true, .OBJC_ASSOCIATION_COPY_NONATOMIC)

Check warning on line 159 in Sources/MiddlewareRum/OpenTelemetry/Instrumentation/URLSession/URLSessionLogger.swift

View workflow job for this annotation

GitHub Actions / tvOS

forming 'UnsafeRawPointer' to an inout variable of type String exposes the internal representation rather than the string contents.

Check warning on line 159 in Sources/MiddlewareRum/OpenTelemetry/Instrumentation/URLSession/URLSessionLogger.swift

View workflow job for this annotation

GitHub Actions / iOS

forming 'UnsafeRawPointer' to an inout variable of type String exposes the internal representation rather than the string contents.

Check warning on line 159 in Sources/MiddlewareRum/OpenTelemetry/Instrumentation/URLSession/URLSessionLogger.swift

View workflow job for this annotation

GitHub Actions / tvOS

forming 'UnsafeRawPointer' to an inout variable of type String exposes the internal representation rather than the string contents.

Check warning on line 159 in Sources/MiddlewareRum/OpenTelemetry/Instrumentation/URLSession/URLSessionLogger.swift

View workflow job for this annotation

GitHub Actions / iOS

forming 'UnsafeRawPointer' to an inout variable of type String exposes the internal representation rather than the string contents.
let propagators = OpenTelemetry.instance.propagators
var traceHeaders = tracePropagationHTTPHeaders(span: span, textMapPropagator: propagators.textMapPropagator, textMapBaggagePropagator: propagators.textMapBaggagePropagator)
if let originalHeaders = request.allHTTPHeaderFields {
Expand Down
Loading