Skip to content

Releases: apple/swift-service-context

1.0.0

31 May 19:37
1.0.0
Compare
Choose a tag to compare

1.0.0: ServiceContext

Please note that the primary module vended by this library is ServiceContext which has changed from the library's pre-1.0 days.

Please continue reading about migrating from the "Baggage" name type if you were using this library from before its 1.0 days.

Migrating off the legacy type name: "Baggage"

This package was initially developed for quite a while as the swift-distributed-tracing-baggage package and was used only by the swift-distributed-tracing project. As time passed, more projects were making use of the baggage type and we decided to name this more generically.

Previously: code using Baggage directly would be using it like this:

import InstrumentationBaggage

private enum FirstTestKey: BaggageKey {
    typealias Value = Int
}

var baggage = Baggage.topLevel // Note, from 1.0 this will emit deprecation warnings
guard let value = baggage[FirstTestKey.self] else {
  return "no value"
}
return "value was: \(value)"

The above snippet continues to work, however it is deprecated upon release.

Please adopt the new spelling of the type, which has the same capabilities as previous type:

import ServiceContextModule

private enum FirstTestKey: ServiceContextKey {
    typealias Value = Int
}

var context = ServiceContext.topLevel
guard let value = context[FirstTestKey.self] else {
  return "no value"
}
return "value was: \(value)"

Everything about ServiceContext is the same as it was with Baggage, and the InstrumentationBaggage module now simply has a typealias Baggage = ServiceContext to ease migration in case you were using this type directly.

The more generic name of "service context" allows developers to use this type for various context propagation needs, without necessarily binding it all with distributed tracing and the baggage terminology.

What's Changed

  • Add .spi.yml for Swift Package Index DocC support by @yim-lee in #29
  • Add CI for Swift 5.8 and update nightly to Ubuntu 22.04 by @yim-lee in #32
  • Update CoC and add CONTRIBUTING file by @ktoso in #33
  • Update CI by @yim-lee in #34
  • Add _unsafeInheritExecutor to withValue convenience func by @ktoso in #35
  • Add test coverage for using withValue inside an actor by @ktoso in #37
  • Change package to ServiceContext; keep baggage compat module by @ktoso in #38
  • Readme update for 1.0 by @ktoso in #39

Full Changelog: 0.4.1...1.0.0

0.4.1

07 Nov 07:53
0.4.1
d0a4929
Compare
Choose a tag to compare

What's Changed

  • Fix missing static keyword by @ktoso in #28

Full Changelog: 0.4.0...0.4.1

0.4.0

07 Nov 07:47
0.4.0
2db9e9d
Compare
Choose a tag to compare

What's Changed

  • DocC setup by @yim-lee in #25
  • Add support for Swift 5.1 (5.0 impossible due to compiler bug) by @slashmo in #26
    • convenience APIs since most people will never use the underlying current value by @ktoso in #27

New Contributors

Full Changelog: 0.3.0...0.4.0

0.3.0

29 Jan 01:39
0.3.0
05f21f5
Compare
Choose a tag to compare

Baggage is Sendable.

0.2.3

29 Jan 01:35
0.2.3
c8457ce
Compare
Choose a tag to compare

Same as 0.2.1, no Sendable requirement - this is introduced now in 0.3.0

0.2.2

28 Jan 02:34
0.2.2
72997ed
Compare
Choose a tag to compare

Fixed Sendable conformances for older OSes

0.2.1

11 Aug 10:50
4239b65
Compare
Choose a tag to compare

Updates:

  • Update SwiftFormat to 0.48.11 (#14)
  • Update installation guide to use 0.2.0 📖 (#15)

For details on the changes please refer to the 0.2.1 milestone

0.2.0

11 Aug 09:42
c2ad168
Compare
Choose a tag to compare

Updated:

  • Breaking: Removed LoggingContext and dependencies, now includes Baggage directly in new InstrumentationBaggage module (#13)

For details on the changes please refer to the 0.2.0 milestone

0.1.1

07 Dec 09:49
0.1.1
Compare
Choose a tag to compare

Same as 0.1.0 however fixed the dependency url in Package.swift to use https rather than git.

0.1.0

04 Dec 09:26
0.1.0
Compare
Choose a tag to compare

Initial release