You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// A `Span` represents an interval from the start of an operation to its end, along with additional metadata included
@@ -98,10 +93,11 @@ public protocol Span: _SwiftTracingSendableSpan {
98
93
/// Implementations SHOULD prevent double-emitting by marking a span as ended internally, however it still is a
99
94
/// programming mistake to rely on this behavior.
100
95
///
101
-
/// - Parameter time: The `DispatchWallTime` at which the span ended.
96
+
/// Parameters:
97
+
/// - clock: The clock to use as time source for the start time of the ``Span``
102
98
///
103
99
/// - SeeAlso: `Span.end()` which automatically uses the "current" time.
104
-
func end(at time:DispatchWallTime)
100
+
func end<Clock:TracerClock>(clock:Clock)
105
101
}
106
102
107
103
extensionSpan{
@@ -115,12 +111,10 @@ extension Span {
115
111
/// Implementations SHOULD prevent double-emitting by marking a span as ended internally, however it still is a
116
112
/// programming mistake to rely on this behavior.
117
113
///
118
-
/// - Parameter time: The `DispatchWallTime` at which the span ended.
119
-
///
120
-
/// - SeeAlso: ``end(at:)`` which allows passing in a specific time, e.g. if the operation was ended and recorded somewhere and we need to post-factum record it.
114
+
/// - SeeAlso: ``end(clock:)`` which allows passing in a specific time, e.g. if the operation was ended and recorded somewhere and we need to post-factum record it.
121
115
/// Generally though prefer using the ``end()`` version of this API in user code and structure your system such that it can be called in the right place and time.
122
116
publicfunc end(){
123
-
self.end(at:.now())
117
+
self.end(clock:DefaultTracerClock())
124
118
}
125
119
126
120
/// Adds a ``SpanLink`` between this `Span` and the given `Span`.
@@ -153,18 +147,31 @@ public struct SpanEvent: Equatable {
153
147
/// One or more ``SpanAttribute``s with the same restrictions as defined for ``Span`` attributes.
154
148
publicvarattributes:SpanAttributes
155
149
156
-
/// The `DispatchWallTime` at which this event occurred.
157
-
publiclettime:DispatchWallTime
150
+
/// The timestamp at which this event occurred.
151
+
///
152
+
/// It should be expressed as the number of milliseconds since UNIX Epoch (January 1st 1970).
153
+
publicletmillisecondsSinceEpoch:UInt64
158
154
159
155
/// Create a new `SpanEvent`.
160
156
/// - Parameters:
161
157
/// - name: The human-readable name of this event.
162
158
/// - attributes: attributes describing this event. Defaults to no attributes.
163
-
/// - time: The `DispatchWallTime` at which this event occurred. Defaults to `.now()`.
164
-
publicinit(name:String, attributes:SpanAttributes=[:], at time:DispatchWallTime=.now()){
159
+
/// - clock: The clock to use as time source for the start time of the ``Span``
0 commit comments