feat(events): structured event framework + namespace & replication li…#10890
Draft
michaely520 wants to merge 1 commit into
Draft
feat(events): structured event framework + namespace & replication li…#10890michaely520 wants to merge 1 commit into
michaely520 wants to merge 1 commit into
Conversation
…fecycle events
Add common/events: a pluggable events.Handler for emitting structured
("wide") events, with a typed Encoder (incl. Any for whole-object values), a
global event registry (NewEventDef) with startup duplicate-name validation, a
default handler that logs each event as one line keyed by the event type, and
a noop handler. Wired through the server via WithCustomEventHandler, catalog
validation at bootstrap, a per-service fx provider, and a GetEventHandler()
accessor on ShardContext.
Define two events on the framework:
- NamespaceLifecycle: a generic, phase-discriminated namespace event (stable
identity fields + a nested "details" object). Emitters supply the phases.
- ReplicationLifecycle: traces a replication task sent -> executing -> applied
across sync_workflow_state / sync_versioned_transition /
verify_versioned_transition, emitted at the stream sender, the passive
executables, and the ndc workflow-state replicator (post-apply mutable-state
summary, no extra read).
Emission is best-effort and nil-safe (TODO: gate behind dynamic config before
production).
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.
…fecycle events
Add common/events: a pluggable events.Handler for emitting structured ("wide") events, with a typed Encoder (incl. Any for whole-object values), a global event registry (NewEventDef) with startup duplicate-name validation, a default handler that logs each event as one line keyed by the event type, and a noop handler. Wired through the server via WithCustomEventHandler, catalog validation at bootstrap, a per-service fx provider, and a GetEventHandler() accessor on ShardContext.
Define two events on the framework:
Emission is best-effort and nil-safe (TODO: gate behind dynamic config before production).
What changed?
Describe what has changed in this PR.
Why?
Tell your future self why have you made these changes.
How did you test it?
Potential risks
Any change is risky. Identify all risks you are aware of. If none, remove this section.