Skip to content

fix(cluster): improve streaming dispatch logging and observability#2915

Merged
vroldanbet merged 6 commits intomainfrom
streaming-fixes
Feb 24, 2026
Merged

fix(cluster): improve streaming dispatch logging and observability#2915
vroldanbet merged 6 commits intomainfrom
streaming-fixes

Conversation

@vroldanbet
Copy link
Contributor

@vroldanbet vroldanbet commented Feb 20, 2026

Summary

  • Enrich log messages with request context: propagate log.Ctx(ctx) throughout all dispatch log calls (trace/warn/debug) so request-scoped fields (e.g. requestID) are included in every log line
  • Increase log timestamp resolution to nanoseconds: set zerolog.TimeFieldFormat = time.RFC3339Nano globally and add WithTimestampFormat(time.RFC3339Nano) to all gRPC log interceptors, helping log aggregators order events correctly
  • Add deadline to streaming dispatcher contexts: embed the context deadline in the logger attached to primary and secondary streaming dispatch contexts for easier debugging
  • Fix non-empty placeholder for dispatcher results: replace empty string "" with $$no_dispatcher_results constant as the initial value of returnedResultsDispatcherName, making the no-results vs. empty-name distinction explicit and preventing a silent bug
  • Code quality: rename withTimeoutctxWithTimeout to avoid var shadowing, pass context explicitly to addResultTime, pass handler context explicitly to runHandler, add guard against empty dispatcher names

Test plan

  • Run existing cluster dispatch unit tests: go test ./internal/dispatch/remote/...
  • Verify log output includes requestID and nanosecond timestamps for dispatch-related log lines
  • Confirm streaming dispatch still works end-to-end with secondary dispatchers configured

🤖 Generated with Claude Code

@github-actions github-actions bot added area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) area/dispatch Affects dispatching of requests labels Feb 20, 2026
@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 75.34247% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.52%. Comparing base (05f1566) to head (16c885e).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
internal/dispatch/remote/cluster.go 74.63% 15 Missing and 2 partials ⚠️
cmd/spicedb/main.go 0.00% 1 Missing ⚠️

❌ Your project check has failed because the head coverage (74.52%) is below the target coverage (75.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2915      +/-   ##
==========================================
+ Coverage   74.51%   74.52%   +0.02%     
==========================================
  Files         484      484              
  Lines       59201    59242      +41     
==========================================
+ Hits        44109    44146      +37     
- Misses      11995    11999       +4     
  Partials     3097     3097              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vroldanbet vroldanbet changed the title secondary streaming fixes fix(cluster): secondary streaming fixes Feb 20, 2026
@github-actions github-actions bot added the area/cli Affects the command line label Feb 20, 2026
@vroldanbet vroldanbet changed the title fix(cluster): secondary streaming fixes fix(cluster): improve streaming dispatch logging and observability Feb 24, 2026
@vroldanbet vroldanbet marked this pull request as ready for review February 24, 2026 18:26
@vroldanbet vroldanbet requested a review from a team as a code owner February 24, 2026 18:26
@vroldanbet vroldanbet self-assigned this Feb 24, 2026
Copy link
Member

@josephschorr josephschorr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vroldanbet vroldanbet enabled auto-merge (squash) February 24, 2026 18:32
@vroldanbet vroldanbet merged commit a11d9dc into main Feb 24, 2026
78 of 79 checks passed
@vroldanbet vroldanbet deleted the streaming-fixes branch February 24, 2026 18:35
@github-actions github-actions bot locked and limited conversation to collaborators Feb 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area/cli Affects the command line area/dispatch Affects dispatching of requests area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants