@@ -38,28 +38,28 @@ class URLSessionLogger {
3838 return nil
3939 }
4040
41- var attributes = [ String: String ] ( )
41+ var attributes = [ String: AttributeValue ] ( )
4242
43- attributes [ SemanticAttributes . httpMethod. rawValue] = request. httpMethod ?? " unknown_method "
43+ attributes [ SemanticAttributes . httpMethod. rawValue] = AttributeValue . string ( request. httpMethod ?? " unknown_method " )
4444
4545 if let requestURL = request. url {
46- attributes [ SemanticAttributes . httpUrl. rawValue] = requestURL. absoluteString
46+ attributes [ SemanticAttributes . httpUrl. rawValue] = AttributeValue . string ( requestURL. absoluteString)
4747 }
4848
4949 if let requestURLPath = request. url? . path {
50- attributes [ SemanticAttributes . httpTarget. rawValue] = requestURLPath
50+ attributes [ SemanticAttributes . httpTarget. rawValue] = AttributeValue . string ( requestURLPath)
5151 }
5252
5353 if let host = request. url? . host {
54- attributes [ SemanticAttributes . netPeerName. rawValue] = host
54+ attributes [ SemanticAttributes . netPeerName. rawValue] = AttributeValue . string ( host)
5555 }
5656
5757 if let requestScheme = request. url? . scheme {
58- attributes [ SemanticAttributes . httpScheme. rawValue] = requestScheme
58+ attributes [ SemanticAttributes . httpScheme. rawValue] = AttributeValue . string ( requestScheme)
5959 }
6060
6161 if let port = request. url? . port {
62- attributes [ SemanticAttributes . netPeerPort. rawValue] = String ( port)
62+ attributes [ SemanticAttributes . netPeerPort. rawValue] = AttributeValue . int ( port)
6363 }
6464
6565 var spanName = " HTTP " + ( request. httpMethod ?? " " )
@@ -106,7 +106,7 @@ class URLSessionLogger {
106106 }
107107
108108 let statusCode = httpResponse. statusCode
109- span. setAttribute ( key: SemanticAttributes . httpStatusCode. rawValue, value: AttributeValue . string ( String ( statusCode) ) )
109+ span. setAttribute ( key: SemanticAttributes . httpStatusCode. rawValue, value: AttributeValue . int ( statusCode) )
110110 span. status = statusForStatusCode ( code: statusCode)
111111
112112 instrumentation. configuration. receivedResponse ? ( response, dataOrFile, span)
@@ -122,7 +122,7 @@ class URLSessionLogger {
122122 guard span != nil else {
123123 return
124124 }
125- span. setAttribute ( key: SemanticAttributes . httpStatusCode. rawValue, value: AttributeValue . string ( String ( statusCode) ) )
125+ span. setAttribute ( key: SemanticAttributes . httpStatusCode. rawValue, value: AttributeValue . int ( statusCode) )
126126 span. status = URLSessionLogger . statusForStatusCode ( code: statusCode)
127127 instrumentation. configuration. receivedError ? ( error, dataOrFile, statusCode, span)
128128
0 commit comments