Skip to content

Introduce PSR-14 Event for Intercepting and Modifying Data Sent to Sentry #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

balatD
Copy link

@balatD balatD commented Apr 9, 2025

This pull request introduces a PSR-14 event within the extension. This allows developers to intercept the data being prepared for transmission to Sentry, enabling them to prevent specific data from being sent or to modify the exception information before it reaches the Sentry service.

new BeforeSentryCaptureEvent($exception)
);

if (!$event->isPropagationStopped()) {
Copy link
Contributor

@brotkrueml brotkrueml Apr 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO isPropagationStopped() check is used wrong here: the event dispatcher takes care to check if other listeners in the queue should be called (isPropagationStopped() returns true). You use this to avoid the sending of exceptions to Sentry - which is wrong IMHO.

There may be valid use cases in an installation to define two event listeners where the first one says: I am the one, the second shouldn't be called - then modifies the exception for storage in Sentry and sets propagation stopped - and in your implementation the exception is not send to Sentry altogether. Think of an extension plugin which has a token (person-referenced) in a URL or a user id which the appropriate listener want to obfuscate. Other listeners are not needed to be called therefore.

So, I suggest to decouple that and introduce a separate method to disable the sending of exceptions. Maybe the implementation of the stoppable interface is not needed altogether and can be removed.

@christophlehmann
Copy link
Contributor

You can register a custom Integration within $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sentry_client']['options']['integrations']. Did you see that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants