dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.19k stars 9.93k forks source link

Expose per-response telemetry for number of bytes sent from server to client. #38919

Open avparuch opened 2 years ago

avparuch commented 2 years ago

IIS exposes telemetry about number of bytes sent from server to client on a per-request basis. Please see "Server bytes sent" in https://docs.microsoft.com/en-us/windows/win32/http/iis-logging. This is a request to enable similar telemetry for HTTP.sys server and Kestrel. This is useful for egress bandwidth calculations/investigations for large-scale services.

Tratcher commented 2 years ago

Related to, but distinct from #38918, the request and response scenarios are pretty different to implement and consume.

Tratcher commented 2 years ago

We need to check if this number includes headers, body, etc..

Reporting it to the app in a feature is tricky because it will change over the lifetime of a response, and in some cases the response isn't sent at all until the pipeline unwinds.

ghost commented 2 years ago

Thanks for contacting us.

We're moving this issue to the .NET 7 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

ghost commented 2 years ago

Thanks for contacting us.

We're moving this issue to the .NET 8 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

Tratcher commented 1 year ago

Proposal from another customer: #44953

IHttpRequestSizeFeature
{
long RequestLineSize { get; }
long HeaderSize { get; }
long? BodySize { get; } // find appropriate optimization based on buffering/content-length?
long TotalRequestSize { get; }
}

IHttpResponseSizeFeature
{
// similar to above
}