Skip to content

Commit 61cde0d

Browse files
committed
compat with 5.6
1 parent f446292 commit 61cde0d

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

Sources/Tracing/Tracer.swift

-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ extension Tracer {
120120
}
121121
#endif
122122

123-
124123
// ==== withSpan + sync ---------------------------------------------------
125124

126125
/// Start a new ``Span`` and automatically end when the `operation` completes,
@@ -314,5 +313,4 @@ extension Tracer {
314313
}
315314
}
316315
#endif
317-
318316
}

Tests/TracingTests/DynamicTracepointTracerTests.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,13 @@ extension DynamicTracepointTestTracer {
281281
return span
282282
}
283283

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)
291291
{
292292
self.operationName = operationName
293293
self.startTime = startTime.millisSinceEpoch

Tests/TracingTests/TestTracer.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ final class TestSpan: Span {
150150

151151
let onEnd: (TestSpan) -> Void
152152

153-
init(
153+
init<Instant: TracerInstantProtocol>(
154154
operationName: String,
155-
startTime: some TracerInstantProtocol,
155+
startTime: Instant,
156156
baggage: Baggage,
157157
kind: SpanKind,
158158
onEnd: @escaping (TestSpan) -> Void
@@ -181,7 +181,7 @@ final class TestSpan: Span {
181181
self.recordedErrors.append((error, attributes))
182182
}
183183

184-
func end<Clock: TracerClock>(clock: Clock = DefaultTracerClock()) {
184+
func end<Clock: TracerClock>(clock: Clock) {
185185
self.endTime = clock.now.millisSinceEpoch
186186
self.onEnd(self)
187187
}

Tests/TracingTests/TracedLockTests.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private final class TracedLockPrintlnTracer: LegacyTracerProtocol {
6464
_ operationName: String,
6565
baggage: @autoclosure () -> Baggage,
6666
ofKind kind: SpanKind,
67-
clock: Clock = DefaultTracerClock(),
67+
clock: Clock,
6868
function: String,
6969
file fileID: String,
7070
line: UInt
@@ -124,9 +124,9 @@ private final class TracedLockPrintlnTracer: LegacyTracerProtocol {
124124

125125
private(set) var isRecording = false
126126

127-
init(
127+
init<Instant: TracerInstantProtocol>(
128128
operationName: String,
129-
startTime: some TracerInstantProtocol,
129+
startTime: Instant,
130130
kind: SpanKind,
131131
baggage: Baggage
132132
) {

Tests/TracingTests/TracerTimeTests.swift

+5
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,13 @@ final class TracerTimeTests: XCTestCase {
4242

4343
let mockClock = MockClock()
4444
mockClock.setTime(13)
45+
#if swift(>=5.7.0)
4546
let span: TestSpan = tracer.startSpan("start", clock: mockClock)
4647
XCTAssertEqual(span.startTime, 13)
48+
#else
49+
let span: TestSpan = tracer.startAnySpan("start", clock: mockClock) as! TestSpan
50+
XCTAssertEqual(span.startTime, 13)
51+
#endif
4752
}
4853
}
4954

0 commit comments

Comments
 (0)