Skip to content

fix(core): Ensure global event processors are always applied to event #9064

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

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/core/src/utils/prepareEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Client, ClientOptions, Event, EventHint, StackFrame, StackParser }
import { dateTimestampInSeconds, GLOBAL_OBJ, normalize, resolvedSyncPromise, truncate, uuid4 } from '@sentry/utils';

import { DEFAULT_ENVIRONMENT } from '../constants';
import { notifyEventProcessors } from '../eventProcessors';
import { getGlobalEventProcessors, notifyEventProcessors } from '../eventProcessors';
import { Scope } from '../scope';

/**
Expand Down Expand Up @@ -74,6 +74,9 @@ export function prepareEvent(

// In case we have a hub we reassign it.
result = finalScope.applyToEvent(prepared, hint);
} else {
// Apply global event processors even if there is no scope
result = notifyEventProcessors(getGlobalEventProcessors(), prepared, hint);
}

return result
Expand Down
2 changes: 1 addition & 1 deletion packages/node/test/manual/release-health/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ for (const dir of scenariosDirs) {

const processes = scenarios.map(([filename, filepath]) => {
return new Promise(resolve => {
const scenarioProcess = spawn('node', [filepath]);
const scenarioProcess = spawn('node', [filepath], { timeout: 10000 });
Copy link
Member Author

Choose a reason for hiding this comment

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

Adding a timeout so this does not run forever, if a failure happens.

const output = [];
const errors = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ function cleanUpAndExitSuccessfully() {
}

function assertSessionAggregates(session, expected) {
if (!session.aggregates) {
Copy link
Member Author

Choose a reason for hiding this comment

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

this already failed before, but did not result in test failures because apparently some global event processors were not running and thus no sentry error was produced for this (?)

return;
}
// For loop is added here just in the rare occasion that the session count do not land in the same aggregate
// bucket
session.aggregates.forEach(function (_, idx) {
Expand Down