Add correlation IDs to vote processing pipeline#7
Merged
Conversation
Introduce a correlation package with a custom slog.Handler that automatically injects correlation_id from context into log entries. Each webhook notification and ticker refresh gets a unique 8-char hex ID, enabling end-to-end tracing across webhook receipt, vote processing, and WebSocket publish.
Verify that webhook handler injects a correlation ID into the context passed to ProcessMessage. Also allow unpkg.com in connect-src CSP directive to unblock Centrifuge JS source map fetches.
Without this, the default slog handler ignores context values and correlation_id never appears in test log output.
The conduit and all its subscriptions were deleted on every graceful shutdown, requiring users to re-login via OAuth to restore them. Keeping the conduit alive across restarts lets findOrCreateConduit reuse it and configureShard update the webhook URL, so existing subscriptions survive container restarts.
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.
Summary
correlationpackage (internal/platform/correlation/) with context helpers, ID generation (8-char hex), and a customslog.Handlerwrapper that auto-injectscorrelation_idinto log entriesslog.Info/Warn/Error/Debugcalls in the vote pipeline to theirContextvariants so the correlation ID flows through webhook →ProcessMessage→RecordVote→PublishSentimentTest plan
make test-short)make lint)LOG_LEVEL=debug, trigger a vote, verifycorrelation_id=XXXXXXXXappears consistently across all log lines for that requestmake test)🤖 Generated with Claude Code