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

Add correlation trail #18

Merged
merged 1 commit into from
Nov 22, 2021
Merged

Add correlation trail #18

merged 1 commit into from
Nov 22, 2021

Conversation

ttrig
Copy link
Contributor

@ttrig ttrig commented Nov 12, 2021

tldr; Build a "trail" for audited events to make it possible to figure out the order of events without relying on occured_at.

// Service A (incoming request without correlation headers)
audit($user)->foo(); # trail = null ("root" event)
JobWithCorrelation::dispatch(); # audited events get trail null
Http::withCorrelation()->post('service-b'); # contains X-Correlation-ID

// Service B
audit($user)->bar(); # trail = "abcd"
JobWithCorrelation::dispatch(); # audited events get trail "abcd"
Http::withCorrelation()->post('service-c'); # contains X-Correlation-ID and X-Correlation-Trail

// Service C
audit($user)->baz(); # trail = "abcd:efgh"
JobWithCorrelation::dispatch(); # audited events get trail "abcd.efgh"
  • demo
  • test in prod

@ttrig ttrig requested a review from wecc November 12, 2021 16:50
@ttrig ttrig force-pushed the add-correlation-trace-id branch 2 times, most recently from 704d8f0 to d1361d4 Compare November 12, 2021 16:53
@ttrig ttrig changed the title WIP/RFC: Add correlation trace WIP/RFC: Add correlation trail Nov 13, 2021
@ttrig ttrig force-pushed the add-correlation-trace-id branch from d1361d4 to a2ba156 Compare November 13, 2021 12:57
@ttrig ttrig force-pushed the add-correlation-trace-id branch 2 times, most recently from b0bae0b to 67c5700 Compare November 13, 2021 13:21
@ttrig ttrig force-pushed the add-correlation-trace-id branch from 67c5700 to bd0b647 Compare November 15, 2021 14:27
@ttrig ttrig changed the title WIP/RFC: Add correlation trail Add correlation trail Nov 15, 2021
@ttrig ttrig marked this pull request as ready for review November 15, 2021 14:27
src/Auditor.php Outdated Show resolved Hide resolved
@ttrig ttrig force-pushed the add-correlation-trace-id branch from bd0b647 to b9c0940 Compare November 22, 2021 12:19
@ttrig ttrig merged commit fc0e788 into master Nov 22, 2021
@ttrig ttrig deleted the add-correlation-trace-id branch November 22, 2021 12:21
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.

7 participants