newrelic / newrelic-dotnet-agent

The New Relic .NET language agent.
Apache License 2.0
97 stars 58 forks source link

Warn about known aspnet instrumentation failure scenarios #2830

Open nrcventura opened 3 hours ago

nrcventura commented 3 hours ago

Aspnet instrumentation stores its context data (transaction and current segment in HttpContext). Sometimes this context storage can get cleared out, when this happens the agent will lose track of the transaction until it is garbage collected. This results in incorrect timing and missing data from the transaction

Calls to Response.End can trigger the aspnet runtime to return the response immediately and not run anymore steps in the aspnet pipeline. This prevents the final step in the pipeline from running which results in the transaction never ending. This also results in the transaction being lost and eventually being garbage collected. This can result in missing data (such as a missing response status code) and incorrect timing.

We should determine whether its possible to write some instrumentation for these two scenarios to at least be able to log a warning about this happening. If it's possible, we should also consider writing code to better handle these situations.

Estimates

Initial t-shirt size: M

workato-integration[bot] commented 3 hours ago

https://new-relic.atlassian.net/browse/NR-324679