[chain-pr 3/10] DatadogCore: CoreMessageBus implementation and rename#2929
Draft
maxep wants to merge 4 commits into
Draft
[chain-pr 3/10] DatadogCore: CoreMessageBus implementation and rename#2929maxep wants to merge 4 commits into
maxep wants to merge 4 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
12f8b82 to
e2c1a49
Compare
ed91047 to
2469c47
Compare
e2c1a49 to
eebd698
Compare
2469c47 to
588136c
Compare
eebd698 to
0d4a09e
Compare
588136c to
c482945
Compare
0d4a09e to
9abfa86
Compare
5 tasks
9c99efb to
219583e
Compare
c482945 to
c2710e2
Compare
Base automatically changed from
maxep/message-bus-subscription--chain-2
to
feature/message-bus-subscription
June 16, 2026 10:55
c2710e2 to
bf59182
Compare
…orTests.swift to Xcode project
12483fe to
39dd976
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why?
The typed
MessageBusprotocol introduced in PR #2927 and the test infrastructure added in PR #2928 are ready, but the productionMessageBusclass inDatadogCorestill only implements the legacyFeatureMessagedispatch path. UntilCoreMessageBusimplements the typed protocol, no production code can route messages through the new typed bus.This PR is the core implementation layer: it renames the internal
MessageBusclass toCoreMessageBusto free the protocol name, implements the typedMessageBusprotocol on it with a bucket-based dispatch table, wiresDatadogCoreto expose it via themessageBusproperty, and migrates the twoDatadogContextreceivers (ContextSharingTransformerandNetworkContextCoreProvider) from the legacyFeatureMessageReceiverinterface to the typedBusMessageReceiver.How?
MessageBus.swift→CoreMessageBus.swift— typed protocol implementationCoreMessageBusgains a keyed dispatch table and a fullMessageBusconformance:receivers: [String: [ObjectIdentifier: Dispatch]]BusMessage.key; inner key is the receiver's object identity. Only receivers registered for a given message kind are iterated on dispatch.subscribe<Receiver>(receiver:)BusMessageReceiver; captures it strongly in aDispatchclosure. Re-subscribing replaces the previous entry.unsubscribe<Receiver>(receiver:)send<Message>(message:else:).configurationtelemetry for the existing deferred-accumulation path. Callsfallbackwhen the core is nil or the bucket is empty.Configuration telemetry is still intercepted before bucket dispatch to preserve the existing deferred-accumulation behaviour, and the legacy
FeatureMessagepath is kept for receivers that haven't migrated yet:DatadogCore— expose the typed busDatadogCorerenames itsbusproperty type fromMessageBus(the old class, nowCoreMessageBus) and exposes the typed bus throughDatadogCoreProtocol:Context updates are now routed through the typed bus:
ContextSharingTransformerandNetworkContextCoreProvider— typed-bus migrationBoth
DatadogContextreceivers are migrated fromFeatureMessageReceivertoBusMessageReceiver:ContextSharingTransformerFeatureMessageReceiver— switches on.contextBusMessageReceiver<DatadogContext>— receives typed context directlyNetworkContextCoreProviderFeatureMessageReceiver— guards on.contextBusMessageReceiver<DatadogContext>— receives typed context directlyReview checklist
make api-surfacewhen adding new APIsChain overview
graph LR G1["1 — Typed MessageBus protocol and shared message types"] G2["2 — Test infrastructure for typed message bus"] G3["3 — DatadogCore: CoreMessageBus implementation and rename"] G4["4 — DatadogCrashReporting: typed-bus migration"] G5["5 — DatadogLogs: typed-bus migration"] G6["6 — DatadogTrace: typed-bus migration"] G7["7 — DatadogFlags: typed-bus migration"] G8["8 — DatadogRUM: typed-bus migration and TelemetryInterceptor merge"] G9["9 — DatadogSessionReplay and DatadogWebViewTracking: typed-bus migration"] G10["10 — Documentation updates"] G1 --> G2 G2 --> G3 G3 --> G4 G3 --> G5 G5 --> G6 G3 --> G7 G6 --> G8 G7 --> G8 G8 --> G9 G1 --> G10Merge in dependency order. PRs with no incoming edges from un-merged PRs can be reviewed in parallel.