Skip to content

Add before_send_metric callback processing in sentry-core #1025

@szokeasaurusrex

Description

@szokeasaurusrex

Add before_send_metric to ClientOptions and execute it in the metric prepare path so metrics can be modified or dropped before batching. Callback execution should happen after scope/default attribute enrichment and before enqueue.

Scope

Apply the relevant logic from #997 where useful, focused on sentry-core/src/clientoptions.rs and sentry-core/src/client.rs, aligned with processing pipeline step 4 and initialization options. Include tests for callback drop and callback mutation. If code is reused from #997, include Co-authored-by: Joris Bayer <joris.bayer@sentry.io> in commit trailers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions