Skip to content

Commit 3d5adfb

Browse files
committed
Formatting
1 parent 236138b commit 3d5adfb

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

Sources/GRPCInterceptors/Tracing/ServerOTelTracingInterceptor.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
*/
1616

1717
public import GRPCCore
18-
internal import Tracing
1918
internal import Synchronization
19+
internal import Tracing
2020

2121
/// A server interceptor that extracts tracing information from the request.
2222
///
2323
/// The extracted tracing information is made available to user code via the current `ServiceContext`.
24-
///
24+
///
2525
/// For more information, refer to the documentation for `swift-distributed-tracing`.
2626
///
2727
/// This interceptor will also inject all required and recommended span and event attributes, and set span status, as defined by
@@ -104,7 +104,7 @@ public struct ServerOTelTracingInterceptor: ServerInterceptor {
104104
var event = SpanEvent(name: "rpc.message")
105105
event.attributes.rpc.messageType = "RECEIVED"
106106
event.attributes.rpc.messageID =
107-
messageReceivedCounter
107+
messageReceivedCounter
108108
.wrappingAdd(1, ordering: .sequentiallyConsistent)
109109
.oldValue
110110
span.addEvent(event)
@@ -130,7 +130,7 @@ public struct ServerOTelTracingInterceptor: ServerInterceptor {
130130
var event = SpanEvent(name: "rpc.message")
131131
event.attributes.rpc.messageType = "SENT"
132132
event.attributes.rpc.messageID =
133-
messageSentCounter
133+
messageSentCounter
134134
.wrappingAdd(1, ordering: .sequentiallyConsistent)
135135
.oldValue
136136
span.addEvent(event)

Sources/GRPCInterceptors/Tracing/SpanAttributes+RPCAttributes.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
internal import Tracing
1817
internal import GRPCCore
18+
internal import Tracing
1919

2020
@dynamicMemberLookup
2121
package struct RPCAttributes: SpanAttributeNamespace {
@@ -187,7 +187,9 @@ private enum PeerAddress {
187187
return
188188
}
189189
self = .ipv6(
190-
address: String(addressComponents[1..<addressComponents.count-1].joined(separator: ":")),
190+
address: String(
191+
addressComponents[1 ..< addressComponents.count - 1].joined(separator: ":")
192+
),
191193
port: port
192194
)
193195

Tests/GRPCInterceptorsTests/TracingInterceptorTests.swift

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ final class TracingInterceptorTests: XCTestCase {
574574
[
575575
"Received request",
576576
"Finished processing request",
577-
"Sent response end"
577+
"Sent response end",
578578
]
579579
)
580580
} assertAttributes: { attributes in
@@ -591,7 +591,7 @@ final class TracingInterceptorTests: XCTestCase {
591591
"network.transport": .string("tcp"),
592592
"network.type": .string("ipv4"),
593593
"client.address": .string("10.1.2.80"),
594-
"client.port": .int(567)
594+
"client.port": .int(567),
595595
]
596596
)
597597
} assertStatus: { status in
@@ -656,7 +656,7 @@ final class TracingInterceptorTests: XCTestCase {
656656
[
657657
"Received request",
658658
"Finished processing request",
659-
"Sent response end"
659+
"Sent response end",
660660
]
661661
)
662662
} assertAttributes: { attributes in
@@ -673,7 +673,7 @@ final class TracingInterceptorTests: XCTestCase {
673673
"network.transport": .string("tcp"),
674674
"network.type": .string("ipv6"),
675675
"client.address": .string("2001::130F:::09C0:876A:130B"),
676-
"client.port": .int(1234)
676+
"client.port": .int(1234),
677677
]
678678
)
679679
} assertStatus: { status in
@@ -738,7 +738,7 @@ final class TracingInterceptorTests: XCTestCase {
738738
[
739739
"Received request",
740740
"Finished processing request",
741-
"Sent response end"
741+
"Sent response end",
742742
]
743743
)
744744
} assertAttributes: { attributes in
@@ -752,7 +752,7 @@ final class TracingInterceptorTests: XCTestCase {
752752
"network.peer.address": .string("some-path"),
753753
"network.transport": .string("tcp"),
754754
"network.type": .string("unix"),
755-
"client.address": .string("some-path")
755+
"client.address": .string("some-path"),
756756
]
757757
)
758758
} assertStatus: { status in
@@ -846,7 +846,7 @@ final class TracingInterceptorTests: XCTestCase {
846846
"network.transport": .string("tcp"),
847847
"network.type": .string("ipv4"),
848848
"client.address": .string("10.1.2.80"),
849-
"client.port": .int(567)
849+
"client.port": .int(567),
850850
]
851851
)
852852
} assertStatus: { status in
@@ -902,7 +902,7 @@ final class TracingInterceptorTests: XCTestCase {
902902
"network.transport": .string("tcp"),
903903
"network.type": .string("ipv4"),
904904
"client.address": .string("10.1.2.80"),
905-
"client.port": .int(567)
905+
"client.port": .int(567),
906906
]
907907
)
908908
} assertStatus: { status in
@@ -937,7 +937,9 @@ final class TracingInterceptorTests: XCTestCase {
937937
// Make sure we get the metadata injected into our service context
938938
XCTAssertEqual(ServiceContext.current?.traceID, traceIDString)
939939

940-
return StreamingServerResponse<String>(error: RPCError(code: .unavailable, message: "Test error"))
940+
return StreamingServerResponse<String>(
941+
error: RPCError(code: .unavailable, message: "Test error")
942+
)
941943
}
942944

943945
XCTAssertThrowsError(try response.accepted.get())
@@ -948,7 +950,7 @@ final class TracingInterceptorTests: XCTestCase {
948950
[
949951
"Received request",
950952
"Finished processing request",
951-
"Sent error response"
953+
"Sent error response",
952954
]
953955
)
954956
} assertAttributes: { attributes in
@@ -966,7 +968,7 @@ final class TracingInterceptorTests: XCTestCase {
966968
"network.transport": .string("tcp"),
967969
"network.type": .string("ipv4"),
968970
"client.address": .string("10.1.2.80"),
969-
"client.port": .int(567)
971+
"client.port": .int(567),
970972
]
971973
)
972974
} assertStatus: { status in

0 commit comments

Comments
 (0)