Event Processors
With eventProcessors
you can hook into the process of enriching the event with additional data. You can add your own eventProcessor
on the current scope. The difference between beforeSend
and eventProcessors
is that eventProcessors
run on the scope level whereas beforeSend
runs globally, no matter which scope you're in.
Also, eventProcessors
optionally receive the hint (see: hints).
Copied
// This will be set globally for every succeeding event send
Sentry.configureScope(function(scope) {
scope.addEventProcessor(function(event, hint) {
// Add anything to the event here
// returning null will drop the event
return event;
});
});
// Using withScope, will only call the event processor for all "sends"
// that happen within withScope
Sentry.withScope(function(scope) {
scope.addEventProcessor(function(event, hint) {
// Add anything to the event here
// returning null will drop the event
return event;
});
Sentry.captureMessage("Test");
});
- Package:
- npm:@sentry/node
- Version:
- 8.24.0
- Repository:
- https://github.com/getsentry/sentry-javascript