Skip to content

Refactor OnEvaluating event hook to avoid delegate allocation #4253

@jamescrosswell

Description

@jamescrosswell

The outer ConfigureScope call no longer allocates a closure, but this OnEvaluating event handler still allocates unconditionally. One solution might be to store KeyValuePairs of the callback and its argument instead of using an event inside a Stack. Perhaps the Stack wouldn't even be necessary when the Sentry.AspNetCore.Grpc integration isn't loaded, as that seems to be the only other place (outside of tests) where this event handler is assigned.

Originally posted by @KnapSac in #4244 (comment)

Worth reading through that whole thread on the other issue before coming up with a solution (and probably worth putting some benchmarks together - possibly some load tests as well).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions