Skip to content

[SDT-0002]: (SSC side) move ServiceContext from SSC to SDT implementation - #92

Merged
kukushechkin merged 11 commits into
apple:mainfrom
kukushechkin:move-service-context-to-sdt
Oct 12, 2026
Merged

kukushechkin merged 11 commits into
apple:mainfrom
kukushechkin:move-service-context-to-sdt

Conversation

@kukushechkin

@kukushechkin kukushechkin commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Turn this package into a thin compatibility layer over swift-distributed-tracing.

Motivation:

Companion to apple/swift-distributed-tracing#240. ServiceContext's implementation moved there, renamed to TracingContext. This package now re-exports it instead of owning it.

Modifications:

  • Added a dependency on swift-distributed-tracing.
  • ServiceContextModule re-exports its ContextStorage module and declares its own non-deprecated ServiceContext/ServiceContextKey/AnyServiceContextKey typealiases.
  • Moved the behavior test suite to swift-distributed-tracing.
  • Add a compatibility smoke test.
  • Updated the README to point new adopters at swift-distributed-tracing directly.

Result:

import ServiceContextModule keeps working with no code changes and no deprecation warning, even in a file that also imports Tracing directly. New code should depend on swift-distributed-tracing and use TracingContext instead.

Comment thread README.md
Comment thread Package.swift
),
],
dependencies: [
.package(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be changed before merging. And this defines the sequence of merges — SDT first, SSC follows.

Comment thread Sources/ServiceContextModule/CompatibilityShim.swift Outdated
Comment thread Sources/ServiceContextModule/Docs.docc/index.md Outdated
@kukushechkin

Copy link
Copy Markdown
Contributor Author

Also, TracingContext is renamed to InstrumentationContext, as discussed here: apple/swift-distributed-tracing#240 (comment)

czechboy0 added a commit to apple/swift-distributed-tracing that referenced this pull request Oct 12, 2026
Move `ServiceContext` from swift-service-context as
`Instrumentation.InstrumentationContext`. Implements SDT-0002, companion
to apple/swift-service-context#92.

## Motivation:

`ServiceContext` lived in its own package mainly for
swift-distributed-tracing users, adding release overhead for little
benefit. The name also reads as server-specific, discouraging non-server
adoption.

## Modifications:

- Moved `ServiceContext` to `Instrumentation`.
- Renamed `ServiceContext`/`ServiceContextKey`/`AnyServiceContextKey` to
`InstrumentationContext`/`InstrumentationContextKey`/`AnyInstrumentationContextKey`,
keeping deprecated typealiases for old symbols.

## Result:

Existing code keeps compiling unchanged. Direct dependents using the old
names get a deprecation warning with a fix-it; swift-service-context
dependents get none, by design.

`diagnose-api-breaking-changes` reports breaking changes across
`Tracing`/`Instrumentation`/`InMemoryTracing`, all "type changed to
`Instrumentation.InstrumentationContext`". This is expected —
typealiases are transparent to the type system, so this shows up no
matter which name call sites use, and we don't target ABI stability
here, only source-compatibility.

---------

Co-authored-by: Joseph Heck <j_heck@apple.com>
Co-authored-by: Honza Dvorsky <honza@apple.com>
@kukushechkin
kukushechkin force-pushed the move-service-context-to-sdt branch from 1d205d1 to 789833f Compare October 12, 2026 13:30

@slashmo slashmo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to go to me once we tagged 1.6.0 in Swift Distributed Tracing.

@slashmo slashmo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kukushechkin

Copy link
Copy Markdown
Contributor Author

Dependency updated for swift-distributed-tracing 1.6.0

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

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants