Skip to content

Commit

Permalink
Add event procesor adding request data to event
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst committed Aug 19, 2022
1 parent 638afc6 commit 1830018
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/nextjs/src/config/wrappers/wrapperUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { captureException, getCurrentHub, startTransaction } from '@sentry/core';
import { addRequestDataToEvent } from '@sentry/node';
import { getActiveTransaction } from '@sentry/tracing';
import { Transaction } from '@sentry/types';
import { fill } from '@sentry/utils';
Expand Down Expand Up @@ -103,6 +104,16 @@ export function callTracedServerSideDataFetcher<F extends (...args: any[]) => Pr
const currentScope = getCurrentHub().getScope();
if (currentScope) {
currentScope.setSpan(dataFetcherSpan);
currentScope.addEventProcessor(event =>
addRequestDataToEvent(event, req, {
include: {
// The `transaction` option tries to extract a transaction name from the request object. We don't want this
// since we already have a high-quality transaction name with a parameterized route. Setting `transaction`
// to `true` will clobber that transaction name.
transaction: false,
},
}),
);
}

try {
Expand Down

0 comments on commit 1830018

Please sign in to comment.