Skip to content

Commit 032c0b3

Browse files
committed
Parametrise tests and move to swift-testing
1 parent 4c11858 commit 032c0b3

File tree

2 files changed

+238
-278
lines changed

2 files changed

+238
-278
lines changed

Sources/GRPCInterceptors/Tracing/ClientOTelTracingInterceptor.swift

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
public import GRPCCore
1818
internal import Synchronization
19-
internal import Tracing
19+
package import Tracing
2020

2121
/// A client interceptor that injects tracing information into the request.
2222
///
@@ -66,9 +66,26 @@ public struct ClientOTelTracingInterceptor: ClientInterceptor {
6666
StreamingClientRequest<Input>,
6767
ClientContext
6868
) async throws -> StreamingClientResponse<Output>
69+
) async throws -> StreamingClientResponse<Output> where Input: Sendable, Output: Sendable {
70+
try await self.intercept(
71+
tracer: InstrumentationSystem.tracer,
72+
request: request,
73+
context: context,
74+
next: next
75+
)
76+
}
77+
78+
/// Same as ``intercept(request:context:next:)``, but allows specifying a `Tracer` for testing purposes.
79+
package func intercept<Input, Output>(
80+
tracer: any Tracer,
81+
request: StreamingClientRequest<Input>,
82+
context: ClientContext,
83+
next: (
84+
StreamingClientRequest<Input>,
85+
ClientContext
86+
) async throws -> StreamingClientResponse<Output>
6987
) async throws -> StreamingClientResponse<Output> where Input: Sendable, Output: Sendable {
7088
var request = request
71-
let tracer = InstrumentationSystem.tracer
7289
let serviceContext = ServiceContext.current ?? .topLevel
7390

7491
tracer.inject(

0 commit comments

Comments
 (0)