Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix response tracing for streaming response bodies #514

Merged
merged 3 commits into from
Jun 18, 2021
Merged

Fix response tracing for streaming response bodies #514

merged 3 commits into from
Jun 18, 2021

Conversation

jdisanti
Copy link
Collaborator

Tracing the response for a streaming body was omitting the actual body from the trace log:

TRACE smithy_http::middleware: response=Response { status: 200, version: HTTP/1.1, headers: ...}, body: SdkBody { inner: Streaming(Body(Streaming)), retryable: false } }

This change results in the actual response body ending up in the trace:

TRACE smithy_http::middleware: response=Response { status: 200, version: HTTP/1.1, headers: ...}, body: b"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<LocationConstraint xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">us-west-2</LocationConstraint>" }

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Collaborator

@rcoh rcoh left a comment

Choose a reason for hiding this comment

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

We actually want something a bit more complex where if the response is handed off directly for streaming, we log it as a streaming body but if it gets read fully, we log the loaded body

@rcoh rcoh merged commit 3749a6c into smithy-lang:main Jun 18, 2021
@jdisanti jdisanti deleted the response-trace-fix branch June 18, 2021 21:48
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