Add EventSource/EventCounter tracing and metrics for ANCM In-Proc
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 276
Description
Some of the events/counters to add (some may already exist, others may be valuable too, discuss below):
* Requests - These should probably be emitted by default, when the source is enabled (Information Level).
* `RequestStart` event & counter - Triggered when a request is started
* `RequestStop` event & counter - Triggered when a request is completed (includes response status code)
* `RequestAbort` event & counter - Triggered when a request is terminated abnormally
* `RequestTimeOut` event & counter - Triggered when a request is times out
* `RequestFailure` event & counter - Triggered when an exception escapes from the middleware pipeline.
* `RequestsSucceeded` counter - Counts the number of requests that ended with 2xx-class status codes
* `RequestsRedirected` counter - Counts the number of requests that ended with 3xx-class status codes (this does include 304 Not Modified, but the 3xx class is called "Redirection" in the spec, and isn't a 304 just a redirection to the cache? :P)
* `RequestsRejected` counter - Counts the number of requests that ended with 4xx-class status codes
* `RequestsFailed` counter - Counts the number of requests that ended with 5xx-class status codes
* `RequestsUpgraded` counter - Counts the number of requests that ended with the 101 Switching Protocols status code.
* `RequestDuration` counter - Measures the length of time a request takes to process. (May need to be measured in Kestrel and servers because of flushing)
* Network Details - These should definitely be behind a Keyword or Verbose trace level.
* `RequestBytesRead` counter - Counts the number of bytes read for HTTP requests.
* `ResponseBytesWritten` counter - Counts the number of bytes written for HTTP responses.
These are mostly copied from Kestrel's companion issue (https://github.com/aspnet/KestrelHttpServer/issues/2145). Some of these may not be applicable to ANCM in-proc or may need to be adjusted (for example, the bytes read/written ones may only be able to apply to the Body).
It might be worth coordinating across HttpSysServer and KestrelHttpServer to share code.
See https://gist.github.com/anurse/af1859663ac91c6cf69c820cebe92303 for some guidance on adding EventSources and EventCounters to ASP.NET projects.
Contributor guide
Assessment
This issue has not been assessed yet.