-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nextjs): Create spans in serverside
getInitialProps
- Loading branch information
Showing
7 changed files
with
136 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
14 changes: 9 additions & 5 deletions
14
packages/nextjs/src/config/wrappers/withSentryGetInitialProps.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import { GIProps } from './types'; | ||
import { NextPage } from 'next'; | ||
|
||
import { callDataFetcherTraced } from './wrapperUtils'; | ||
|
||
type GetInitialProps = Required<NextPage<unknown>>['getInitialProps']; | ||
|
||
/** | ||
* Create a wrapped version of the user's exported `getInitialProps` function | ||
* | ||
* @param origGIProps: The user's `getInitialProps` function | ||
* @param origGetInitialProps: The user's `getInitialProps` function | ||
* @param origGIPropsHost: The user's object on which `getInitialProps` lives (used for `this`) | ||
* @returns A wrapped version of the function | ||
*/ | ||
export function withSentryGetInitialProps(origGIProps: GIProps['fn']): GIProps['wrappedFn'] { | ||
return async function (this: unknown, ...args: Parameters<GIProps['fn']>) { | ||
return await origGIProps.call(this, ...args); | ||
export function withSentryGetInitialProps(origGetInitialProps: GetInitialProps, route: string): GetInitialProps { | ||
return function (...getInitialPropsArguments: Parameters<GetInitialProps>): ReturnType<GetInitialProps> { | ||
return callDataFetcherTraced(origGetInitialProps, getInitialPropsArguments, { route, op: 'getInitialProps' }); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters