Remove HttpMetricsEnrichmentContext caching #110580
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
List
s), 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 theList
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.