Skip to content

Commit 723bf92

Browse files
committed
Formatting
1 parent 044cc65 commit 723bf92

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
@@ -552,7 +552,7 @@ final class TracingInterceptorTests: XCTestCase {
552552
[
553553
"Received request",
554554
"Finished processing request",
555-
"Sent response end"
555+
"Sent response end",
556556
]
557557
)
558558
} assertAttributes: { attributes in
@@ -569,7 +569,7 @@ final class TracingInterceptorTests: XCTestCase {
569569
"network.transport": .string("tcp"),
570570
"network.type": .string("ipv4"),
571571
"client.address": .string("10.1.2.80"),
572-
"client.port": .int(567)
572+
"client.port": .int(567),
573573
]
574574
)
575575
} assertStatus: { status in
@@ -634,7 +634,7 @@ final class TracingInterceptorTests: XCTestCase {
634634
[
635635
"Received request",
636636
"Finished processing request",
637-
"Sent response end"
637+
"Sent response end",
638638
]
639639
)
640640
} assertAttributes: { attributes in
@@ -651,7 +651,7 @@ final class TracingInterceptorTests: XCTestCase {
651651
"network.transport": .string("tcp"),
652652
"network.type": .string("ipv6"),
653653
"client.address": .string("2001::130F:::09C0:876A:130B"),
654-
"client.port": .int(1234)
654+
"client.port": .int(1234),
655655
]
656656
)
657657
} assertStatus: { status in
@@ -716,7 +716,7 @@ final class TracingInterceptorTests: XCTestCase {
716716
[
717717
"Received request",
718718
"Finished processing request",
719-
"Sent response end"
719+
"Sent response end",
720720
]
721721
)
722722
} assertAttributes: { attributes in
@@ -730,7 +730,7 @@ final class TracingInterceptorTests: XCTestCase {
730730
"network.peer.address": .string("some-path"),
731731
"network.transport": .string("tcp"),
732732
"network.type": .string("unix"),
733-
"client.address": .string("some-path")
733+
"client.address": .string("some-path"),
734734
]
735735
)
736736
} assertStatus: { status in
@@ -824,7 +824,7 @@ final class TracingInterceptorTests: XCTestCase {
824824
"network.transport": .string("tcp"),
825825
"network.type": .string("ipv4"),
826826
"client.address": .string("10.1.2.80"),
827-
"client.port": .int(567)
827+
"client.port": .int(567),
828828
]
829829
)
830830
} assertStatus: { status in
@@ -880,7 +880,7 @@ final class TracingInterceptorTests: XCTestCase {
880880
"network.transport": .string("tcp"),
881881
"network.type": .string("ipv4"),
882882
"client.address": .string("10.1.2.80"),
883-
"client.port": .int(567)
883+
"client.port": .int(567),
884884
]
885885
)
886886
} assertStatus: { status in
@@ -915,7 +915,9 @@ final class TracingInterceptorTests: XCTestCase {
915915
// Make sure we get the metadata injected into our service context
916916
XCTAssertEqual(ServiceContext.current?.traceID, traceIDString)
917917

918-
return StreamingServerResponse<String>(error: RPCError(code: .unavailable, message: "Test error"))
918+
return StreamingServerResponse<String>(
919+
error: RPCError(code: .unavailable, message: "Test error")
920+
)
919921
}
920922

921923
XCTAssertThrowsError(try response.accepted.get())
@@ -926,7 +928,7 @@ final class TracingInterceptorTests: XCTestCase {
926928
[
927929
"Received request",
928930
"Finished processing request",
929-
"Sent error response"
931+
"Sent error response",
930932
]
931933
)
932934
} assertAttributes: { attributes in
@@ -944,7 +946,7 @@ final class TracingInterceptorTests: XCTestCase {
944946
"network.transport": .string("tcp"),
945947
"network.type": .string("ipv4"),
946948
"client.address": .string("10.1.2.80"),
947-
"client.port": .int(567)
949+
"client.port": .int(567),
948950
]
949951
)
950952
} assertStatus: { status in

0 commit comments

Comments
 (0)