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

Allow logging of body without modifying the actual response #5628

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

dariusclay
Copy link
Contributor

@dariusclay dariusclay commented Nov 12, 2024

Closes #5511
Makes #4377 obsolete

Microsoft Reviewers: Open in CodeFlow

@dariusclay dariusclay marked this pull request as draft November 13, 2024 09:10
@dariusclay dariusclay marked this pull request as ready for review November 13, 2024 15:35
{
if (streamToReadFrom.CanSeek)
await WriteStreamToPipeAsync(streamToReadFrom, pipe.Writer, cancellationToken).ConfigureAwait(false);
}, CancellationToken.None);
Copy link
Member

@eduherminio eduherminio Nov 14, 2024

Choose a reason for hiding this comment

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

Is CancellationToken.None preferred over using cancellationToken?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I originally had it passed both to the inner task to write the stream to pipe, and the background task. My thoughts here is the inner task gets cancelled the thread will terminate anyway. I may be wrong about this. What do we prefer here?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure, we're using it in TcpEndpointProbesService like this, but not in FunctionInvokingChatClient .

After doing some reading, If believe it doesn't really matter in our scenario, given we are using it for the internal call and we don't have children tasks inside of this Task.Run(), and we're relying on the status of the cancelled task (cancelled vs faulted).

There seem to be opinions both for and against using it, so your call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AddExtendedHttpClientLogging is truncating body response when it mustn't do it
4 participants