Skip to content

Use IDictionary in public message and error context APIs for pipeline to reduce allocations #7738

@ramonsmits

Description

@ramonsmits

Describe the suggested improvement

Is your improvement related to a problem? Please describe.

Currently the transports are responsible to clone the dictionaries to ensure that when headers are modified during processing that these modified headers are not passed to the error context.

This header cloning results in unneeded allocations when headers are not modified.

Describe the suggested solution

Instead of Dictionary use IDictionary, this allows to use smarter dictionaries like snapshot implementation that allows reverting.

Then update all transports to not clone headers to create their message and error context which are passed to their respective pipelines.

Describe alternatives you've considered

Keeping this the same

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions