Skip to content

Commit 598d900

Browse files
committed
minor readme change
1 parent 4ec9e90 commit 598d900

17 files changed

+246
-282
lines changed

README.md

+41-77
Large diffs are not rendered by default.

Sources/Tracing/Docs.docc/Guides/InstrumentYourLibrary.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ You may want to restore the context once around both those calls, or if that is
189189
actor MySampleServer {
190190

191191
var context: ServiceContext = .topLevel
192-
var userCode: SampleHTTPHandler
192+
var userHandler: SampleHTTPHandler
193193

194194
func onHeaders(headers: HTTPHeaders) async {
195195
await ServiceContext.withValue(self.context) {

Sources/Tracing/Docs.docc/Tracer.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
### Creating Spans
66

7-
- ``withSpan(_:baggage:ofKind:at:function:file:line:_:)-4o2b``
7+
- ``withSpan(_:context:ofKind:at:function:file:line:_:)-4o2b``
88

99
### Manual Span management
1010

11-
- ``startSpan(_:baggage:ofKind:at:function:file:line:)-u1y4``
11+
- ``startSpan(_:context:ofKind:at:function:file:line:)-u1y4``
1212
- ``Span/end()``

Sources/Tracing/NoOpTracer.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ extension NoOpTracer: Tracer {
101101
file fileID: String,
102102
line: UInt
103103
) -> NoOpSpan {
104-
NoOpSpan(baggage: baggage())
104+
NoOpSpan(context: context())
105105
}
106106
}
107107
#endif

Sources/Tracing/SpanProtocol.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -697,18 +697,18 @@ public enum SpanKind {
697697
/// further describe the link.
698698
public struct SpanLink {
699699
/// A `ServiceContext` containing identifying information about the link target ``Span``.
700-
public let baggage: ServiceContext
700+
public let context: ServiceContext
701701

702702
/// ``SpanAttributes`` further describing the connection between the ``Span``s.
703703
public let attributes: SpanAttributes
704704

705705
/// Create a new `SpanLink`.
706706
///
707707
/// - Parameters:
708-
/// - baggage: The `ServiceContext` identifying the targeted ``Span``.
708+
/// - context: The `ServiceContext` identifying the targeted ``Span``.
709709
/// - attributes: ``SpanAttributes`` that further describe the link. Defaults to no attributes.
710-
public init(baggage: ServiceContext, attributes: SpanAttributes) {
711-
self.baggage = baggage
710+
public init(context: ServiceContext, attributes: SpanAttributes) {
711+
self.context = context
712712
self.attributes = attributes
713713
}
714714
}

Sources/Tracing/Tracer.swift

+37-37
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public func startSpan(
100100
InstrumentationSystem.legacyTracer.startAnySpan(
101101
operationName,
102102
at: DefaultTracerClock.now,
103-
context: baggage(),
103+
context: context(),
104104
ofKind: kind,
105105
function: function,
106106
file: fileID,
@@ -112,12 +112,12 @@ public func startSpan(
112112
/// Start a new ``Span`` using the global bootstrapped tracer reimplementation.
113113
///
114114
/// The current task-local `ServiceContext` is picked up and provided to the underlying tracer.
115-
/// It is also possible to pass a specific `baggage` explicitly, in which case attempting
116-
/// to pick up the task-local baggage is prevented. This can be useful when we know that
115+
/// It is also possible to pass a specific `context` explicitly, in which case attempting
116+
/// to pick up the task-local context is prevented. This can be useful when we know that
117117
/// we're about to start a top-level span, or if a span should be started from a different,
118118
/// stored away previously,
119119
///
120-
/// - Note: Prefer ``withSpan(_:baggage:ofKind:at:function:file:line:_:)-4o2b`` to start
120+
/// - Note: Prefer ``withSpan(_:context:ofKind:at:function:file:line:_:)-4o2b`` to start
121121
/// a span as it automatically takes care of ending the span, and recording errors when thrown.
122122
/// Use `startSpan` iff you need to pass the span manually to a different
123123
/// location in your source code to end it.
@@ -127,7 +127,7 @@ public func startSpan(
127127
///
128128
/// - Parameters:
129129
/// - operationName: The name of the operation being traced. This may be a handler function, database call, ...
130-
/// - baggage: The `ServiceContext` providing information on where to start the new ``Span``.
130+
/// - context: The `ServiceContext` providing information on where to start the new ``Span``.
131131
/// - kind: The ``SpanKind`` of the new ``Span``.
132132
/// - instant: the time instant at which the span started
133133
/// - function: The function name in which the span was started
@@ -136,7 +136,7 @@ public func startSpan(
136136
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) // for TaskLocal ServiceContext
137137
public func startSpan(
138138
_ operationName: String,
139-
baggage: @autoclosure () -> ServiceContext = .current ?? .topLevel,
139+
context: @autoclosure () -> ServiceContext = .current ?? .topLevel,
140140
ofKind kind: SpanKind = .internal,
141141
at instant: @autoclosure () -> some TracerInstant = DefaultTracerClock.now,
142142
function: String = #function,
@@ -148,7 +148,7 @@ public func startSpan(
148148
InstrumentationSystem.tracer.startAnySpan(
149149
operationName,
150150
at: instant(),
151-
baggage: baggage(),
151+
context: context(),
152152
ofKind: kind,
153153
function: function,
154154
file: fileID,
@@ -163,8 +163,8 @@ public func startSpan(
163163
/// including recording the `error` in case the operation throws.
164164
///
165165
/// The current task-local `ServiceContext` is picked up and provided to the underlying tracer.
166-
/// It is also possible to pass a specific `baggage` explicitly, in which case attempting
167-
/// to pick up the task-local baggage is prevented. This can be useful when we know that
166+
/// It is also possible to pass a specific `context` explicitly, in which case attempting
167+
/// to pick up the task-local context is prevented. This can be useful when we know that
168168
/// we're about to start a top-level span, or if a span should be started from a different,
169169
/// stored away previously,
170170
///
@@ -174,7 +174,7 @@ public func startSpan(
174174
/// - Parameters:
175175
/// - operationName: The name of the operation being traced. This may be a handler function, database call, ...
176176
/// - instant: the time instant at which the span started
177-
/// - baggage: The `ServiceContext` providing information on where to start the new ``Span``.
177+
/// - context: The `ServiceContext` providing information on where to start the new ``Span``.
178178
/// - kind: The ``SpanKind`` of the new ``Span``.
179179
/// - function: The function name in which the span was started
180180
/// - fileID: The `fileID` where the span was started.
@@ -186,7 +186,7 @@ public func startSpan(
186186
public func withSpan<T, Instant: TracerInstant>(
187187
_ operationName: String,
188188
at instant: @autoclosure () -> Instant,
189-
baggage: @autoclosure () -> ServiceContext = .current ?? .topLevel,
189+
context: @autoclosure () -> ServiceContext = .current ?? .topLevel,
190190
ofKind kind: SpanKind = .internal,
191191
function: String = #function,
192192
file fileID: String = #fileID,
@@ -196,7 +196,7 @@ public func withSpan<T, Instant: TracerInstant>(
196196
try InstrumentationSystem.legacyTracer.withAnySpan(
197197
operationName,
198198
at: DefaultTracerClock.now,
199-
baggage: baggage(),
199+
context: context(),
200200
ofKind: kind,
201201
function: function,
202202
file: fileID,
@@ -210,8 +210,8 @@ public func withSpan<T, Instant: TracerInstant>(
210210
/// including recording the `error` in case the operation throws.
211211
///
212212
/// The current task-local `ServiceContext` is picked up and provided to the underlying tracer.
213-
/// It is also possible to pass a specific `baggage` explicitly, in which case attempting
214-
/// to pick up the task-local baggage is prevented. This can be useful when we know that
213+
/// It is also possible to pass a specific `context` explicitly, in which case attempting
214+
/// to pick up the task-local context is prevented. This can be useful when we know that
215215
/// we're about to start a top-level span, or if a span should be started from a different,
216216
/// stored away previously,
217217
///
@@ -220,7 +220,7 @@ public func withSpan<T, Instant: TracerInstant>(
220220
///
221221
/// - Parameters:
222222
/// - operationName: The name of the operation being traced. This may be a handler function, database call, ...
223-
/// - baggage: The `ServiceContext` providing information on where to start the new ``Span``.
223+
/// - context: The `ServiceContext` providing information on where to start the new ``Span``.
224224
/// - kind: The ``SpanKind`` of the new ``Span``.
225225
/// - function: The function name in which the span was started
226226
/// - fileID: The `fileID` where the span was started.
@@ -231,7 +231,7 @@ public func withSpan<T, Instant: TracerInstant>(
231231
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) // for TaskLocal ServiceContext
232232
public func withSpan<T>(
233233
_ operationName: String,
234-
baggage: @autoclosure () -> ServiceContext = .current ?? .topLevel,
234+
context: @autoclosure () -> ServiceContext = .current ?? .topLevel,
235235
ofKind kind: SpanKind = .internal,
236236
function: String = #function,
237237
file fileID: String = #fileID,
@@ -241,7 +241,7 @@ public func withSpan<T>(
241241
try InstrumentationSystem.legacyTracer.withAnySpan(
242242
operationName,
243243
at: DefaultTracerClock.now,
244-
baggage: baggage(),
244+
context: context(),
245245
ofKind: kind,
246246
function: function,
247247
file: fileID,
@@ -257,8 +257,8 @@ public func withSpan<T>(
257257
/// including recording the `error` in case the operation throws.
258258
///
259259
/// The current task-local `ServiceContext` is picked up and provided to the underlying tracer.
260-
/// It is also possible to pass a specific `baggage` explicitly, in which case attempting
261-
/// to pick up the task-local baggage is prevented. This can be useful when we know that
260+
/// It is also possible to pass a specific `context` explicitly, in which case attempting
261+
/// to pick up the task-local context is prevented. This can be useful when we know that
262262
/// we're about to start a top-level span, or if a span should be started from a different,
263263
/// stored away previously,
264264
///
@@ -268,7 +268,7 @@ public func withSpan<T>(
268268
/// - Parameters:
269269
/// - operationName: The name of the operation being traced. This may be a handler function, database call, ...
270270
/// - instant: the time instant at which the span started
271-
/// - baggage: The `ServiceContext` providing information on where to start the new ``Span``.
271+
/// - context: The `ServiceContext` providing information on where to start the new ``Span``.
272272
/// - kind: The ``SpanKind`` of the new ``Span``.
273273
/// - function: The function name in which the span was started
274274
/// - fileID: The `fileID` where the span was started.
@@ -278,7 +278,7 @@ public func withSpan<T>(
278278
/// - Throws: the error the `operation` has thrown (if any)
279279
public func withSpan<T>(
280280
_ operationName: String,
281-
baggage: @autoclosure () -> ServiceContext = .current ?? .topLevel,
281+
context: @autoclosure () -> ServiceContext = .current ?? .topLevel,
282282
ofKind kind: SpanKind = .internal,
283283
at instant: @autoclosure () -> some TracerInstant = DefaultTracerClock.now,
284284
function: String = #function,
@@ -289,7 +289,7 @@ public func withSpan<T>(
289289
try InstrumentationSystem.legacyTracer.withAnySpan(
290290
operationName,
291291
at: instant(),
292-
baggage: baggage(),
292+
context: context(),
293293
ofKind: kind,
294294
function: function,
295295
file: fileID,
@@ -306,8 +306,8 @@ public func withSpan<T>(
306306
/// including recording the `error` in case the operation throws.
307307
///
308308
/// The current task-local `ServiceContext` is picked up and provided to the underlying tracer.
309-
/// It is also possible to pass a specific `baggage` explicitly, in which case attempting
310-
/// to pick up the task-local baggage is prevented. This can be useful when we know that
309+
/// It is also possible to pass a specific `context` explicitly, in which case attempting
310+
/// to pick up the task-local context is prevented. This can be useful when we know that
311311
/// we're about to start a top-level span, or if a span should be started from a different,
312312
/// stored away previously,
313313
///
@@ -317,7 +317,7 @@ public func withSpan<T>(
317317
/// - Parameters:
318318
/// - operationName: The name of the operation being traced. This may be a handler function, database call, ...
319319
/// - instant: the time instant at which the span started
320-
/// - baggage: The `ServiceContext` providing information on where to start the new ``Span``.
320+
/// - context: The `ServiceContext` providing information on where to start the new ``Span``.
321321
/// - kind: The ``SpanKind`` of the new ``Span``.
322322
/// - function: The function name in which the span was started
323323
/// - fileID: The `fileID` where the span was started.
@@ -329,7 +329,7 @@ public func withSpan<T>(
329329
public func withSpan<T, Instant: TracerInstant>(
330330
_ operationName: String,
331331
at instant: @autoclosure () -> Instant,
332-
baggage: @autoclosure () -> ServiceContext = .current ?? .topLevel,
332+
context: @autoclosure () -> ServiceContext = .current ?? .topLevel,
333333
ofKind kind: SpanKind = .internal,
334334
function: String = #function,
335335
file fileID: String = #fileID,
@@ -339,7 +339,7 @@ public func withSpan<T, Instant: TracerInstant>(
339339
try await InstrumentationSystem.legacyTracer.withAnySpan(
340340
operationName,
341341
at: DefaultTracerClock.now,
342-
baggage: baggage(),
342+
context: context(),
343343
ofKind: kind,
344344
function: function,
345345
file: fileID,
@@ -353,8 +353,8 @@ public func withSpan<T, Instant: TracerInstant>(
353353
/// including recording the `error` in case the operation throws.
354354
///
355355
/// The current task-local `ServiceContext` is picked up and provided to the underlying tracer.
356-
/// It is also possible to pass a specific `baggage` explicitly, in which case attempting
357-
/// to pick up the task-local baggage is prevented. This can be useful when we know that
356+
/// It is also possible to pass a specific `context` explicitly, in which case attempting
357+
/// to pick up the task-local context is prevented. This can be useful when we know that
358358
/// we're about to start a top-level span, or if a span should be started from a different,
359359
/// stored away previously,
360360
///
@@ -363,7 +363,7 @@ public func withSpan<T, Instant: TracerInstant>(
363363
///
364364
/// - Parameters:
365365
/// - operationName: The name of the operation being traced. This may be a handler function, database call, ...
366-
/// - baggage: The `ServiceContext` providing information on where to start the new ``Span``.
366+
/// - context: The `ServiceContext` providing information on where to start the new ``Span``.
367367
/// - kind: The ``SpanKind`` of the new ``Span``.
368368
/// - function: The function name in which the span was started
369369
/// - fileID: The `fileID` where the span was started.
@@ -374,7 +374,7 @@ public func withSpan<T, Instant: TracerInstant>(
374374
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) // for TaskLocal ServiceContext
375375
public func withSpan<T>(
376376
_ operationName: String,
377-
baggage: @autoclosure () -> ServiceContext = .current ?? .topLevel,
377+
context: @autoclosure () -> ServiceContext = .current ?? .topLevel,
378378
ofKind kind: SpanKind = .internal,
379379
function: String = #function,
380380
file fileID: String = #fileID,
@@ -384,7 +384,7 @@ public func withSpan<T>(
384384
try await InstrumentationSystem.legacyTracer.withAnySpan(
385385
operationName,
386386
at: DefaultTracerClock.now,
387-
baggage: baggage(),
387+
context: context(),
388388
ofKind: kind,
389389
function: function,
390390
file: fileID,
@@ -399,8 +399,8 @@ public func withSpan<T>(
399399
/// including recording the `error` in case the operation throws.
400400
///
401401
/// The current task-local `ServiceContext` is picked up and provided to the underlying tracer.
402-
/// It is also possible to pass a specific `baggage` explicitly, in which case attempting
403-
/// to pick up the task-local baggage is prevented. This can be useful when we know that
402+
/// It is also possible to pass a specific `context` explicitly, in which case attempting
403+
/// to pick up the task-local context is prevented. This can be useful when we know that
404404
/// we're about to start a top-level span, or if a span should be started from a different,
405405
/// stored away previously,
406406
///
@@ -409,7 +409,7 @@ public func withSpan<T>(
409409
///
410410
/// - Parameters:
411411
/// - operationName: The name of the operation being traced. This may be a handler function, database call, ...
412-
/// - baggage: The `ServiceContext` providing information on where to start the new ``Span``.
412+
/// - context: The `ServiceContext` providing information on where to start the new ``Span``.
413413
/// - kind: The ``SpanKind`` of the new ``Span``.
414414
/// - instant: the time instant at which the span started
415415
/// - function: The function name in which the span was started
@@ -420,7 +420,7 @@ public func withSpan<T>(
420420
/// - Throws: the error the `operation` has thrown (if any)
421421
public func withSpan<T>(
422422
_ operationName: String,
423-
baggage: @autoclosure () -> ServiceContext = .current ?? .topLevel,
423+
context: @autoclosure () -> ServiceContext = .current ?? .topLevel,
424424
ofKind kind: SpanKind = .internal,
425425
at instant: @autoclosure () -> some TracerInstant = DefaultTracerClock.now,
426426
function: String = #function,
@@ -431,7 +431,7 @@ public func withSpan<T>(
431431
try await InstrumentationSystem.legacyTracer.withAnySpan(
432432
operationName,
433433
at: instant(),
434-
baggage: baggage(),
434+
context: context(),
435435
ofKind: kind,
436436
function: function,
437437
file: fileID,

0 commit comments

Comments
 (0)