Skip to content

Breaking change - dropped explicit export of ServiceContextModule #251

Open

Description

@williazz

Hi folks, looks like we may have caused a breaking change in v1.6.0 which drops explicit export of ServiceContextModule. Can we please continue supporting it until the next major version?

See open-telemetry/opentelemetry-swift#1228

Activity

  1. changed the title [-]Breaking change - dropped explicit import of `ServiceContextModule`[/-] [+]Breaking change - dropped explicit export of `ServiceContextModule`[/+] on Oct 12, 2026
  2. kukushechkin commented on Oct 12, 2026

    @kukushechkin
    Contributor

    Thank you @williazz for the report and for opentelemetry-swift#1228 fix.

    We do not plan to restore ServiceContextModule availability from this package.

    • OTelSwiftTracing does not explicitly depend on ServiceContextModule. SwiftPM exposes transitive modules to the compiler, so the import compiled while depending on swift-distributed-tracing 1.5.0, but SwiftPM does not promise this. There is a special compiler flag --explicit-target-dependency-import-check to check for this to be safe.
    • Unfortunately, it is impossible to create a new module in SDT with the old module name, as that name would collide with an older swift-service-context.
    • The names from import Tracing still work in 1.6.0 as deprecated typealiases.

    The fix in #1228 is correct — drop the import and rely on import Tracing. A package that needs the old ServiceContextModule should depend on swift-service-context. SDT-0002 documents this under "Breaking changes". We also discussed this case in the SDT-0002 review thread.

    We will keep this Issue open so other can see it.

  3. 0xTim commented on Oct 12, 2026

    @0xTim
    Contributor

    To be fair, with the @_exported that was removed in https://github.com/apple/swift-distributed-tracing/pull/240/changes#diff-5c2efeffd3cbaf0bc282145eb3d633deb1b31f782f23d5929cf42222785f4071L16 - this is a major API break, the package opted into vending ServiceContextModule as part of it's API. This isn't just SwiftPM's leaky imports so this should have only been done as a SerVer major and is not being a good ecosystem citizen by breaking like this. This has broken a lot of stuff

  4. williazz commented on Oct 13, 2026

    @williazz
    Author

    ServiceContext is rarely used outside distributed tracing and removing the extra package makes sense here.

    https://forums.swift.org/t/proposal-sdt-0002-move-servicecontext-from-ssc-to-sdt/89514/2

    This has broken a lot of stuff

    It's small potatoes at this point, but I wonder if the magnitude of impact was larger than anticipated during previous discussion?

  5. kukushechkin commented on Oct 13, 2026

    @kukushechkin
    Contributor

    Sorry about this, and thank you for the reports. @0xTim is right: removing the explicitly re-exported ServiceContextModule should not have been shipped in a minor release.

    PRs that restore compatibility:

    What they do:

    • SDT gets a ServiceContextModule in the Instrumentation product. import ServiceContextModule works for packages that depend only on Tracing or Instrumentation.
    • SSC keeps its ServiceContextModule product, but its target gets a different name ServiceContextModuleCompatibility, because SwiftPM needs unique target names across the package graph. SSC also reexports ServiceContextModule from SDT.
    • Removes the deprecation of ServiceContext symbols so any warnings-as-errors do not trigger build failure. — UPD: this we decided to not to include during the review

    For users explicitly depending on both packages, both packages should be updated together, if nothing is pinned, SwiftPM will handle it.

    I've checked several packages (pre- and post- SDT 1.6.0 adoption, if it was already merged), seems to work, but would appreciate more eyes to avoid breaking more stuff.

  6. kukushechkin commented on Oct 13, 2026

    @kukushechkin
    Contributor

    swift-distributed-tracing 1.7.0 is tagged, this should now restore compatibility with import ServiceContextModule. And the corresponding swift-service-context 1.5.0.

  7. williazz commented on Oct 13, 2026

    @williazz
    Author

    v1.7 mitigated the issue for us - thanks @kukushechkin

  8. kukushechkin commented on Oct 14, 2026

    @kukushechkin
    Contributor

    I would keep this opened for now so it is easier discoverable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions