Remove HttpMetricsEnrichmentContext caching by MihaZupan · Pull Request #110580 · dotnet/runtime
Fixes #108284
With this change the HttpMetricsEnrichmentContext is only used while we're running the callbacks, we're no longer storing it on the request properties.
As it's now much more short lived, and doesn't carry as much state (no Lists), there's no point in pooling it.
The change does introduce a bit more allocations as we're now allocating a List<Callback> per request.
If we care, we can add the extra logic to avoid the list allocation when there's just 1 callback.
I'm also using the TagList directly since we're not pooling the List anymore. I think this should still be fine since its default capacity is 8 before allocating more, and we're only adding ~5 tags, so there's room for user-provided ones.