Skip to content

feat(events): structured event framework + namespace & replication li…#10890

Draft
michaely520 wants to merge 1 commit into
mainfrom
events-framework
Draft

feat(events): structured event framework + namespace & replication li…#10890
michaely520 wants to merge 1 commit into
mainfrom
events-framework

Conversation

@michaely520

Copy link
Copy Markdown
Contributor

…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).

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?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Potential risks

Any change is risky. Identify all risks you are aware of. If none, remove this section.

…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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant