Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Add correlation id and debug metadata to events #5451

Merged
merged 12 commits into from
Jan 28, 2025

Conversation

mhsdesign
Copy link
Member

@mhsdesign mhsdesign commented Jan 26, 2025

Resolves first iteration of #3887
Resolves: #4758

Debug information for events from publishing & co

The refactored publishing V3 opens another now used advantage we can now centrally add metadata like a simple correlation id. This is especially helpful to determine a publish sequence in the event log.

event correlation id
ContentStreamWasForked CreateWorkspace_8d7e0569e4ef5a23e4
WorkspaceWasCreated CreateWorkspace_8d7e0569e4ef5a23e4
NodePropertiesWereSet SetNodeProperties_dfff5367b8570a6a53
NodePropertiesWereSet SetNodeProperties_fa36a1a43aab5f8e4f
NodePropertiesWereSet SetNodeProperties_5847b1b016a2a4ec0e
ContentStreamWasClosed PublishIndividualNod_cd08481821b9175938
NodePropertiesWereSet PublishIndividualNod_cd08481821b9175938
ContentStreamWasForked PublishIndividualNod_cd08481821b9175938
ContentStreamWasClosed PublishIndividualNod_cd08481821b9175938
WorkspaceWasPublished PublishIndividualNod_cd08481821b9175938
NodePropertiesWereSet PublishIndividualNod_cd08481821b9175938
NodePropertiesWereSet PublishIndividualNod_cd08481821b9175938
ContentStreamWasReopened PublishIndividualNod_cd08481821b9175938
ContentStreamWasRemoved PublishIndividualNod_cd08481821b9175938

Also for special events like ContentStreamWasForked ContentStreamWasReopened we add additional debug information via debug_reason.

Debug information for events from structure adjustments

As discussed in #4969 (comment), we group all events emitted by a structure adjustment via a common correlation id and additionally add to the metadata the rendered message of why the structure adjustment was necessary.

event correlation id metadata
NodeAggregateWithNodeWasCreated StructureAdjustment_8c9ef43b786f72b75b {debug_reason: 'Content Stream: %s; Dimension Space Point: %s, Node Aggregate: %s --- The tethered child node "bar" is missing.'}
NodePropertiesWereSet StructureAdjustment_8c9ef43b786f72b75b

Upgrade instructions

Review instructions

Checklist

  • Code follows the PSR-2 coding style
  • Tests have been created, run and adjusted as needed
  • The PR is created against the lowest maintained branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked with !!! and have upgrade-instructions

@kitsunet
Copy link
Member

correlation seems good, I think the rest is from the other PRs....

…events

Applies suggestion originally posted in neos#4969 (comment)

the resulting event log would be similar to:

| event                           | correlation id | metadata                                                                                                                                   |
|---------------------------------|----------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| NodeAggregateWithNodeWasCreated | 123456         | `{structureAdjustment: 'Content Stream: %s; Dimension Space Point: %s, Node Aggregate: %s --- The tethered child node "bar" is missing.'}` |
| NodePropertiesWereSet           | 123456         |                                                                                                                                            |
…ng the exception message)

While before neos#4965 a even `WorkspaceRebaseFailed` would contain bloats of data which grew a lot.
A small message in the closed even is not a problem though.
The refactored publishing V3 opens another now used advantage: For commands with multiple events like workspace publishing, we can now centrally add metadata like a simple correlation id.

Note that for 'simple' commands we dont need to do this as `RebaseableCommand::enrichWithCommand` will already group them with a causationId which is what we decided to use for tethered nodes for example. The id never changes for causation ids.
…ration to first event

For commands with multiple events like workspace publishing, we can now add to the event metadata like the causation command short class name. Via the correlation id they are grouped so we only add this information to the first event,

Note that for 'simple' commands we dont need to do this as `RebaseableCommand::enrichWithCommand` will actually fully serialize the command into commandName and payload
... instead of encoding the command into `debug_causationCommand`
@mhsdesign mhsdesign force-pushed the task/add-debug-metadata-to-events branch from a40ba9f to c522ffe Compare January 27, 2025 15:09
@mhsdesign mhsdesign marked this pull request as ready for review January 27, 2025 15:10
@mhsdesign mhsdesign requested review from kitsunet and dlubitz January 27, 2025 15:21
@mhsdesign mhsdesign changed the title TASK: Add debug metadata to events TASK: Add correlation id and debug metadata to events Jan 27, 2025
@mhsdesign mhsdesign merged commit 82b5a18 into neos:9.0 Jan 28, 2025
12 checks passed
@mhsdesign mhsdesign deleted the task/add-debug-metadata-to-events branch January 28, 2025 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add context property to ContentStreamWasForked events
2 participants