feat(cloudslog): store httpRequest, if available - #813
Draft
fredrikaverpil wants to merge 2 commits into
Draft
Conversation
fredrikaverpil
force-pushed
the
slog-error-reporting-v2
branch
6 times, most recently
from
November 6, 2025 17:36
9727839 to
3401e6a
Compare
Contributor
|
I think that would be nice to have, and I have tried it in my pr. One problem though: errors tend to happen during an http call. and cloudrequestlog will only set So to properly fix this, you should make sure that some of the http middleware: https://github.com/einride/cloudrunner-go/blob/master/cloudrequestlog/middleware.go#L189-L223 |
fredrikaverpil
marked this pull request as draft
December 1, 2025 16:42
Store a partial httpRequest on the context before request handling so that error reports logged mid-request can include HTTP request context. The previous approach extracted httpRequest from record attrs, but the middleware only set that after the handler returned — too late for errors.
fredrikaverpil
force-pushed
the
slog-error-reporting-v2
branch
from
April 1, 2026 14:10
3401e6a to
31f94d0
Compare
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.
Why?
There are additional fields we could put onto the error report. See
context.httpRequestpart of the schema.The request logging middleware currently only sets
httpRequeston the recordafter the handler returns (for access logging). This means errors logged
during request handling never have
httpRequestavailable for error reports.What?
cloudslog.WithHTTPRequest) to store a partialhttpRequeston the context before request handling begins.httpRequestin the error report'scontextgroup.cloudrequestlog) sets the partialhttpRequeston thecontext in all server-side entry points (gRPC unary, gRPC stream, HTTP).
httpRequest(with status,latency, response size) as a record attribute after the handler returns —
no duplication or interference.
Notes
cc @ngalaiko — addressed your feedback
about the timing issue by using a context-based approach.