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
**Motivation:**
The baggage type ended up more useful than anticipated and we're
renaming it to ServiceContext for the 1.0 release.
Many libraries and production systems and up passing context around
which may not necessarily be related to tracing, which made us make this
naming change. Functionally ServiceContext and Baggage are the same, but
the way we talk about context propagation in general makes more sense if
we call this a context stype.
**Modifications:**
Use the new type; The `Baggage` still exists in the
`InstrumentationBaggage` module so people can still use it if they
wanted to but it is a TYPEALIAS to the ServiceContext.
### Context propagation, by explicit `LoggingContext` passing
332
332
333
-
> `LoggingContext` naming has been carefully selected and it reflects the type's purpose and utility: It binds a [Swift Log `Logger`](https://github.com/apple/swift-log) with an associated distributed tracing [Baggage](https://github.com/apple/swift-distributed-tracing-baggage).
333
+
> `LoggingContext` naming has been carefully selected and it reflects the type's purpose and utility: It binds a [Swift Log `Logger`](https://github.com/apple/swift-log) with an associated distributed tracing [Baggage](https://github.com/apple/swift-service-context).
334
334
>
335
335
> It _also_ is used for tracing, by tracers reaching in to read or modify the carried baggage.
336
336
@@ -417,8 +417,8 @@ Generally application developers _should not_ create new context objects, but ra
417
417
418
418
If really necessary, or for the purposes of testing, one can create a baggage or context using one of the two factory functions:
419
419
420
-
-[`DefaultLoggingContext.topLevel(logger:)`](https://github.com/apple/swift-distributed-tracing-baggage/blob/main/Sources/Baggage/LoggingContext.swift) or [`Baggage.topLevel`](https://github.com/apple/swift-distributed-tracing-baggage-core/blob/main/Sources/CoreBaggage/Baggage.swift) - which creates an empty context/baggage, without any values. It should _not_ be used too frequently, and as the name implies in applications it only should be used on the "top level" of the application, or at the beginning of a contextless (e.g. timer triggered) event processing.
421
-
-[`DefaultLoggingContext.TODO(logger:reason:)`](https://github.com/apple/swift-distributed-tracing-baggage/blob/main/Sources/Baggage/LoggingContext.swift) or [`Baggage.TODO`](https://github.com/apple/swift-distributed-tracing-baggage-core/blob/main/Sources/CoreBaggage/Baggage.swift) - which should be used to mark a parameter where "before this code goes into production, a real context should be passed instead." An application can be run with `-DBAGGAGE_CRASH_TODOS` to cause the application to crash whenever a TODO context is still in use somewhere, making it easy to diagnose and avoid breaking context propagation by accidentally leaving in a `TODO` context in production.
420
+
-[`DefaultLoggingContext.topLevel(logger:)`](https://github.com/apple/swift-service-context/blob/main/Sources/Baggage/LoggingContext.swift) or [`Baggage.topLevel`](https://github.com/apple/swift-service-context-core/blob/main/Sources/CoreBaggage/Baggage.swift) - which creates an empty context/baggage, without any values. It should _not_ be used too frequently, and as the name implies in applications it only should be used on the "top level" of the application, or at the beginning of a contextless (e.g. timer triggered) event processing.
421
+
-[`DefaultLoggingContext.TODO(logger:reason:)`](https://github.com/apple/swift-service-context/blob/main/Sources/Baggage/LoggingContext.swift) or [`Baggage.TODO`](https://github.com/apple/swift-service-context-core/blob/main/Sources/CoreBaggage/Baggage.swift) - which should be used to mark a parameter where "before this code goes into production, a real context should be passed instead." An application can be run with `-DBAGGAGE_CRASH_TODOS` to cause the application to crash whenever a TODO context is still in use somewhere, making it easy to diagnose and avoid breaking context propagation by accidentally leaving in a `TODO` context in production.
422
422
423
423
Please refer to the respective functions documentation for details.
424
424
@@ -549,7 +549,7 @@ Creating an instrument means adopting the `Instrument` protocol (or `Tracer` in
549
549
The two methods will be called by instrumented libraries/frameworks at asynchronous boundaries, giving you a chance to
550
550
act on the provided information or to add additional information to be carried across these boundaries.
551
551
552
-
> Check out the [`Baggage` documentation](https://github.com/apple/swift-distributed-tracing-baggage) for more information on
552
+
> Check out the [`Baggage` documentation](https://github.com/apple/swift-service-context) for more information on
553
553
how to retrieve values from the `LoggingContext` and how to set values on it.
/// A pseudo-``Instrument`` that may be used to instrument using multiple other ``Instrument``s across a
18
-
/// common `Baggage`.
18
+
/// common `ServiceContext`.
19
19
publicstructMultiplexInstrument{
20
20
privatevarinstruments:[Instrument]
21
21
22
22
/// Create a ``MultiplexInstrument``.
23
23
///
24
24
/// - Parameter instruments: An array of ``Instrument``s, each of which will be used to ``Instrument/inject(_:into:using:)`` or ``Instrument/extract(_:into:using:)``
0 commit comments