File tree 5 files changed +18
-15
lines changed
5 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,6 @@ extension Tracer {
120
120
}
121
121
#endif
122
122
123
-
124
123
// ==== withSpan + sync ---------------------------------------------------
125
124
126
125
/// Start a new ``Span`` and automatically end when the `operation` completes,
@@ -314,5 +313,4 @@ extension Tracer {
314
313
}
315
314
}
316
315
#endif
317
-
318
316
}
Original file line number Diff line number Diff line change @@ -281,13 +281,13 @@ extension DynamicTracepointTestTracer {
281
281
return span
282
282
}
283
283
284
- init ( operationName: String ,
285
- startTime: some TracerInstantProtocol ,
286
- baggage: Baggage ,
287
- kind: SpanKind ,
288
- file fileID: String ,
289
- line: UInt ,
290
- onEnd: @escaping ( TracepointSpan ) -> Void )
284
+ init < Instant : TracerInstantProtocol > ( operationName: String ,
285
+ startTime: Instant ,
286
+ baggage: Baggage ,
287
+ kind: SpanKind ,
288
+ file fileID: String ,
289
+ line: UInt ,
290
+ onEnd: @escaping ( TracepointSpan ) -> Void )
291
291
{
292
292
self . operationName = operationName
293
293
self . startTime = startTime. millisSinceEpoch
Original file line number Diff line number Diff line change @@ -150,9 +150,9 @@ final class TestSpan: Span {
150
150
151
151
let onEnd : ( TestSpan ) -> Void
152
152
153
- init (
153
+ init < Instant : TracerInstantProtocol > (
154
154
operationName: String ,
155
- startTime: some TracerInstantProtocol ,
155
+ startTime: Instant ,
156
156
baggage: Baggage ,
157
157
kind: SpanKind ,
158
158
onEnd: @escaping ( TestSpan ) -> Void
@@ -181,7 +181,7 @@ final class TestSpan: Span {
181
181
self . recordedErrors. append ( ( error, attributes) )
182
182
}
183
183
184
- func end< Clock: TracerClock > ( clock: Clock = DefaultTracerClock ( ) ) {
184
+ func end< Clock: TracerClock > ( clock: Clock ) {
185
185
self . endTime = clock. now. millisSinceEpoch
186
186
self . onEnd ( self )
187
187
}
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ private final class TracedLockPrintlnTracer: LegacyTracerProtocol {
64
64
_ operationName: String ,
65
65
baggage: @autoclosure ( ) -> Baggage ,
66
66
ofKind kind: SpanKind ,
67
- clock: Clock = DefaultTracerClock ( ) ,
67
+ clock: Clock ,
68
68
function: String ,
69
69
file fileID: String ,
70
70
line: UInt
@@ -124,9 +124,9 @@ private final class TracedLockPrintlnTracer: LegacyTracerProtocol {
124
124
125
125
private( set) var isRecording = false
126
126
127
- init (
127
+ init < Instant : TracerInstantProtocol > (
128
128
operationName: String ,
129
- startTime: some TracerInstantProtocol ,
129
+ startTime: Instant ,
130
130
kind: SpanKind ,
131
131
baggage: Baggage
132
132
) {
Original file line number Diff line number Diff line change @@ -42,8 +42,13 @@ final class TracerTimeTests: XCTestCase {
42
42
43
43
let mockClock = MockClock ( )
44
44
mockClock. setTime ( 13 )
45
+ #if swift(>=5.7.0)
45
46
let span : TestSpan = tracer. startSpan ( " start " , clock: mockClock)
46
47
XCTAssertEqual ( span. startTime, 13 )
48
+ #else
49
+ let span : TestSpan = tracer. startAnySpan ( " start " , clock: mockClock) as! TestSpan
50
+ XCTAssertEqual ( span. startTime, 13 )
51
+ #endif
47
52
}
48
53
}
49
54
You can’t perform that action at this time.
0 commit comments