Skip to content

feat: add upstream request/response logging for passthrough routes#186

Open
pawbana wants to merge 4 commits intomainfrom
pb/dump-passthrough
Open

feat: add upstream request/response logging for passthrough routes#186
pawbana wants to merge 4 commits intomainfrom
pb/dump-passthrough

Conversation

@pawbana
Copy link
Contributor

@pawbana pawbana commented Feb 19, 2026

Added request/response dump functionality for passthrough routes.

  • Added RoundTripperMiddleware in the apidump package.
  • Updated the Provider interface to expose the APIDumpDir method

Drive by change

  • Improved error handling in the dumper code

Copy link
Contributor Author

pawbana commented Feb 19, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@pawbana pawbana marked this pull request as ready for review February 19, 2026 16:21
if !bytes.HasSuffix(result, []byte("\n")) {
result = append(result, []byte("\n")...)
}
// Trim trailing newline added by pretty.Pretty.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was there a reson for removing trailing new line?
Viewing dumps in terminal without it is annoying.

@dannykopping
Copy link
Collaborator

I'm thinking we should perhaps hold off on this change until #166 lands. If we have a session ID then we can correlate all intercepted and passthrough routes.

If you'd rather land this in the interim and then add session ID correlation later, that's fine too - in which case I'll give this a review.

@pawbana
Copy link
Contributor Author

pawbana commented Feb 23, 2026

I'm thinking we should perhaps hold off on this change until #166 lands. If we have a session ID then we can correlate all intercepted and passthrough routes.

Will session ID be available in each request? Or only in requests from clients that set it?

@dannykopping
Copy link
Collaborator

I'm thinking we should perhaps hold off on this change until #166 lands. If we have a session ID then we can correlate all intercepted and passthrough routes.

Will session ID be available in each request? Or only in requests from clients that set it?

Only if clients set it

@pawbana
Copy link
Contributor Author

pawbana commented Feb 23, 2026

I'm thinking we should perhaps hold off on this change until #166 lands. If we have a session ID then we can correlate all intercepted and passthrough routes.

Will session ID be available in each request? Or only in requests from clients that set it?

Only if clients set it

If session ID is not always set I'm not sure what do you mean by session ID correlation. Traffic dumping (both intercepted or passed though) will need to work without session ID.

I agree that dump file names are unfortunate for pass though routes (file names contain random UUIDs, not related to anything) but I wanted to keep the same format. Maybe different approach would be better.
Now that I think about it maybe it would be helpful to add this UUID to Passthrough trace and PassthroughCount metric? Although I'm not sure if it matches original intention behind interception ID.

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.

2 participants