Skip to content

Add a before hook to session replay #4834

@aellett

Description

@aellett

Problem Statement

I occasionally use beforeSend to do some extra processing of events before they get sent to Sentry, and I'd like to have a similar capability around session replay. For example, I might want to have an allow-list of certain (user) identifiers or features that should allow a replay to be sent. At the same time, any replay associated with a user/transaction that isn't on that allow-list should be discarded at the client level.

Solution Brainstorm

I thought that this might already exist in the beforeSend hook, but when I examined the event available in that block, it didn't seem like I had an API to access any potential replays. It's possible that I missed it or that it's private, but that was the first place I looked.

I also looked at some of the other beforeXXX hooks, and I saw there was one for beforeCaptureScreenshot and beforeCaptureViewHierarchy, so for consistency I thought it wouldn't be unreasonable to have a beforeSendSessionReplay or beforeCaptureSessionReplay. Obviously those are two different ideas, but I think I could use either of them to get what I'm looking for.

Are you willing to submit a PR?

No response

Metadata

Metadata

Assignees

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