[chain-pr 7/10] DatadogFlags: typed-bus migration#2933
Conversation
This comment has been minimized.
This comment has been minimized.
ed91047 to
2469c47
Compare
185b00a to
f54b5ec
Compare
2469c47 to
588136c
Compare
f54b5ec to
c97dbac
Compare
588136c to
c482945
Compare
c97dbac to
2f2ffbc
Compare
c482945 to
c2710e2
Compare
2f2ffbc to
176b9f2
Compare
12483fe to
39dd976
Compare
176b9f2 to
c7c0769
Compare
…FlagEvaluationReceiver migrates
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 775ac7ec68
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| telemetry: core.telemetry | ||
| ) | ||
|
|
||
| core.messageBus.subscribe(receiver: FlagEvaluationReceiver(monitor: monitor)) |
There was a problem hiding this comment.
Avoid leaking flag receivers across RUM registrations
When RUM is enabled more than once on the same core, or when RUMFeature is constructed but core.register(feature:) later fails, this installs a new typed-bus FlagEvaluationReceiver that is never replaced or unsubscribed; the typed bus retains receivers until unsubscribe, unlike the legacy messageReceiver path that DatadogCore.register replaces by feature key. Later flag evaluations are therefore delivered to stale monitors as well as the current one, which can duplicate feature-flag updates or use stale RUM configuration. Store the receiver/subscription and remove or replace it during teardown/re-registration.
Useful? React with 👍 / 👎.
What and why?
With
CoreMessageBusimplementing the typedMessageBusprotocol (PR #2929),DatadogFlagscan stop routing flag evaluation events throughFeatureScopeand send them directly on the typed bus.RUMFlagEvaluationReporterpreviously held aFeatureScopereference and calledfeatureScope.send(message: .payload(RUMFlagEvaluationMessage(...))). TheFeatureScopewas only used for itssendcapability, not for event writing, making it a heavier dependency than needed. It now holds aMessageBusreference and callsmessageBus.send(message:)directly.This simplifies the
FlagsFeaturefactory:makeRUMFlagEvaluationReporterpreviously required aFeatureScopeargument passed through fromFlagsClient. That argument is removed — the factory closure now capturescore.messageBusdirectly at feature initialisation time.How?
RUMFlagEvaluationReporter.swift—FeatureScope→MessageBusFlagsFeature.swift— factory closure capturesmessageBusFlagsClient.swift— call site simplificationReview 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.