@@ -34,16 +34,16 @@ import Dispatch
34
34
///
35
35
/// - Parameters:
36
36
/// - operationName: The name of the operation being traced. This may be a handler function, database call, ...
37
- /// - clock: The clock to use as time source for the start time of the ``Span``
37
+ /// - instant: the time instant at which the span started
38
38
/// - baggage: The `Baggage` providing information on where to start the new ``Span``.
39
39
/// - kind: The ``SpanKind`` of the new ``Span``.
40
40
/// - function: The function name in which the span was started
41
41
/// - fileID: The `fileID` where the span was started.
42
42
/// - line: The file line where the span was started.
43
43
@available ( macOS 10 . 15 , iOS 13 , tvOS 13 , watchOS 6 , * ) // for TaskLocal Baggage
44
- public func startSpan< Clock : TracerClock > (
44
+ public func startSpan< Instant : TracerInstant > (
45
45
_ operationName: String ,
46
- clock : Clock ,
46
+ at instant : @autoclosure ( ) -> Instant ,
47
47
baggage: @autoclosure ( ) -> Baggage = . current ?? . topLevel,
48
48
ofKind kind: SpanKind = . internal,
49
49
function: String = #function,
@@ -54,7 +54,7 @@ public func startSpan<Clock: TracerClock>(
54
54
// we try to not use the deprecated methods ourselves anyway
55
55
InstrumentationSystem . legacyTracer. startAnySpan (
56
56
operationName,
57
- clock : clock ,
57
+ at : instant ( ) ,
58
58
baggage: baggage ( ) ,
59
59
ofKind: kind,
60
60
function: function,
@@ -99,7 +99,7 @@ public func startSpan(
99
99
// we try to not use the deprecated methods ourselves anyway
100
100
InstrumentationSystem . legacyTracer. startAnySpan (
101
101
operationName,
102
- clock : DefaultTracerClock ( ) ,
102
+ at : DefaultTracerClock . now ,
103
103
baggage: baggage ( ) ,
104
104
ofKind: kind,
105
105
function: function,
@@ -129,7 +129,7 @@ public func startSpan(
129
129
/// - operationName: The name of the operation being traced. This may be a handler function, database call, ...
130
130
/// - baggage: The `Baggage` providing information on where to start the new ``Span``.
131
131
/// - kind: The ``SpanKind`` of the new ``Span``.
132
- /// - clock: The clock to use as time source for the start time of the ``Span``
132
+ /// - instant: the time instant at which the span started
133
133
/// - function: The function name in which the span was started
134
134
/// - fileID: The `fileID` where the span was started.
135
135
/// - line: The file line where the span was started.
@@ -138,7 +138,7 @@ public func startSpan(
138
138
_ operationName: String ,
139
139
baggage: @autoclosure ( ) -> Baggage = . current ?? . topLevel,
140
140
ofKind kind: SpanKind = . internal,
141
- clock : some TracerClock = DefaultTracerClock ( ) ,
141
+ at instant : @autoclosure ( ) -> some TracerInstant = DefaultTracerClock . now ,
142
142
function: String = #function,
143
143
file fileID: String = #fileID,
144
144
line: UInt = #line
@@ -147,7 +147,7 @@ public func startSpan(
147
147
// we try to not use the deprecated methods ourselves anyway
148
148
InstrumentationSystem . tracer. startAnySpan (
149
149
operationName,
150
- clock : clock ,
150
+ at : instant ( ) ,
151
151
baggage: baggage ( ) ,
152
152
ofKind: kind,
153
153
function: function,
@@ -173,7 +173,7 @@ public func startSpan(
173
173
///
174
174
/// - Parameters:
175
175
/// - operationName: The name of the operation being traced. This may be a handler function, database call, ...
176
- /// - clock: The clock to use as time source for the start time of the ``Span``
176
+ /// - instant: the time instant at which the span started
177
177
/// - baggage: The `Baggage` providing information on where to start the new ``Span``.
178
178
/// - kind: The ``SpanKind`` of the new ``Span``.
179
179
/// - function: The function name in which the span was started
@@ -183,9 +183,9 @@ public func startSpan(
183
183
/// - Returns: the value returned by `operation`
184
184
/// - Throws: the error the `operation` has thrown (if any)
185
185
@available ( macOS 10 . 15 , iOS 13 , tvOS 13 , watchOS 6 , * ) // for TaskLocal Baggage
186
- public func withSpan< T, Clock : TracerClock > (
186
+ public func withSpan< T, Instant : TracerInstant > (
187
187
_ operationName: String ,
188
- clock : Clock ,
188
+ at instant : @autoclosure ( ) -> Instant ,
189
189
baggage: @autoclosure ( ) -> Baggage = . current ?? . topLevel,
190
190
ofKind kind: SpanKind = . internal,
191
191
function: String = #function,
@@ -195,7 +195,7 @@ public func withSpan<T, Clock: TracerClock>(
195
195
) rethrows -> T {
196
196
try InstrumentationSystem . legacyTracer. withAnySpan (
197
197
operationName,
198
- clock : DefaultTracerClock ( ) ,
198
+ at : DefaultTracerClock . now ,
199
199
baggage: baggage ( ) ,
200
200
ofKind: kind,
201
201
function: function,
@@ -240,7 +240,7 @@ public func withSpan<T>(
240
240
) rethrows -> T {
241
241
try InstrumentationSystem . legacyTracer. withAnySpan (
242
242
operationName,
243
- clock : DefaultTracerClock ( ) ,
243
+ at : DefaultTracerClock . now ,
244
244
baggage: baggage ( ) ,
245
245
ofKind: kind,
246
246
function: function,
@@ -267,7 +267,7 @@ public func withSpan<T>(
267
267
///
268
268
/// - Parameters:
269
269
/// - operationName: The name of the operation being traced. This may be a handler function, database call, ...
270
- /// - clock: The clock to use as time source for the start time of the ``Span``
270
+ /// - instant: the time instant at which the span started
271
271
/// - baggage: The `Baggage` providing information on where to start the new ``Span``.
272
272
/// - kind: The ``SpanKind`` of the new ``Span``.
273
273
/// - function: The function name in which the span was started
@@ -280,15 +280,15 @@ public func withSpan<T>(
280
280
_ operationName: String ,
281
281
baggage: @autoclosure ( ) -> Baggage = . current ?? . topLevel,
282
282
ofKind kind: SpanKind = . internal,
283
- clock : some TracerClock = DefaultTracerClock ( ) ,
283
+ at instant : @autoclosure ( ) -> some TracerInstant = DefaultTracerClock . now ,
284
284
function: String = #function,
285
285
file fileID: String = #fileID,
286
286
line: UInt = #line,
287
287
_ operation: ( any Span ) throws -> T
288
288
) rethrows -> T {
289
289
try InstrumentationSystem . legacyTracer. withAnySpan (
290
290
operationName,
291
- clock : clock ,
291
+ at : instant ( ) ,
292
292
baggage: baggage ( ) ,
293
293
ofKind: kind,
294
294
function: function,
@@ -316,7 +316,7 @@ public func withSpan<T>(
316
316
///
317
317
/// - Parameters:
318
318
/// - operationName: The name of the operation being traced. This may be a handler function, database call, ...
319
- /// - clock: The clock to use as time source for the start time of the ``Span``
319
+ /// - instant: the time instant at which the span started
320
320
/// - baggage: The `Baggage` providing information on where to start the new ``Span``.
321
321
/// - kind: The ``SpanKind`` of the new ``Span``.
322
322
/// - function: The function name in which the span was started
@@ -326,9 +326,9 @@ public func withSpan<T>(
326
326
/// - Returns: the value returned by `operation`
327
327
/// - Throws: the error the `operation` has thrown (if any)
328
328
@available ( macOS 10 . 15 , iOS 13 , tvOS 13 , watchOS 6 , * ) // for TaskLocal Baggage
329
- public func withSpan< T, Clock : TracerClock > (
329
+ public func withSpan< T, Instant : TracerInstant > (
330
330
_ operationName: String ,
331
- clock : Clock ,
331
+ at instant : @autoclosure ( ) -> Instant ,
332
332
baggage: @autoclosure ( ) -> Baggage = . current ?? . topLevel,
333
333
ofKind kind: SpanKind = . internal,
334
334
function: String = #function,
@@ -338,7 +338,7 @@ public func withSpan<T, Clock: TracerClock>(
338
338
) async rethrows -> T {
339
339
try await InstrumentationSystem . legacyTracer. withAnySpan (
340
340
operationName,
341
- clock : DefaultTracerClock ( ) ,
341
+ at : DefaultTracerClock . now ,
342
342
baggage: baggage ( ) ,
343
343
ofKind: kind,
344
344
function: function,
@@ -383,7 +383,7 @@ public func withSpan<T>(
383
383
) async rethrows -> T {
384
384
try await InstrumentationSystem . legacyTracer. withAnySpan (
385
385
operationName,
386
- clock : DefaultTracerClock ( ) ,
386
+ at : DefaultTracerClock . now ,
387
387
baggage: baggage ( ) ,
388
388
ofKind: kind,
389
389
function: function,
@@ -411,7 +411,7 @@ public func withSpan<T>(
411
411
/// - operationName: The name of the operation being traced. This may be a handler function, database call, ...
412
412
/// - baggage: The `Baggage` providing information on where to start the new ``Span``.
413
413
/// - kind: The ``SpanKind`` of the new ``Span``.
414
- /// - clock: The clock to use as time source for the start time of the ``Span``
414
+ /// - instant: the time instant at which the span started
415
415
/// - function: The function name in which the span was started
416
416
/// - fileID: The `fileID` where the span was started.
417
417
/// - line: The file line where the span was started.
@@ -422,15 +422,15 @@ public func withSpan<T>(
422
422
_ operationName: String ,
423
423
baggage: @autoclosure ( ) -> Baggage = . current ?? . topLevel,
424
424
ofKind kind: SpanKind = . internal,
425
- clock : some TracerClock = DefaultTracerClock ( ) ,
425
+ at instant : @autoclosure ( ) -> some TracerInstant = DefaultTracerClock . now ,
426
426
function: String = #function,
427
427
file fileID: String = #fileID,
428
428
line: UInt = #line,
429
429
_ operation: ( any Span ) async throws -> T
430
430
) async rethrows -> T {
431
431
try await InstrumentationSystem . legacyTracer. withAnySpan (
432
432
operationName,
433
- clock : clock ,
433
+ at : instant ( ) ,
434
434
baggage: baggage ( ) ,
435
435
ofKind: kind,
436
436
function: function,
0 commit comments