Skip to content

middleware: add request context to Observer callback - #267

Merged
mccutchen merged 2 commits into
mainfrom
observer-ctx
Jul 26, 2026
Merged

middleware: add request context to Observer callback#267
mccutchen merged 2 commits into
mainfrom
observer-ctx

Conversation

@mccutchen

Copy link
Copy Markdown
Owner

Attempting to belatedly dogfood this Observer mechanism over in mccutchen/httpbingo.org#14, I realized that we should pass the request context to the observer callback so that tracing frameworks can propagate trace/span IDs and other custom per-request metadata.

Unfortunately, this is a breaking change, but I think it's worth the breakage to better support request tracing for those custom deployments that want an easy way to do it.

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.84%. Comparing base (25a9144) to head (1ea07a1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #267      +/-   ##
==========================================
- Coverage   94.98%   94.84%   -0.14%     
==========================================
  Files           9        9              
  Lines        2032     2036       +4     
==========================================
+ Hits         1930     1931       +1     
- Misses         59       62       +3     
  Partials       43       43              
Files with missing lines Coverage Δ
httpbin/middleware.go 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mccutchen mccutchen added enhancement breaking Tracking breaking changes that can only be made with a new major release. labels Jul 26, 2026
@mccutchen
mccutchen merged commit 697b6e3 into main Jul 26, 2026
10 checks passed
@mccutchen
mccutchen deleted the observer-ctx branch July 26, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Tracking breaking changes that can only be made with a new major release. enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant