-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass GCPFunction scope settings for transactions
- Loading branch information
1 parent
750e493
commit a36385b
Showing
7 changed files
with
148 additions
and
118 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 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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Scope, SDK_VERSION } from '@sentry/node'; | ||
import { addExceptionMechanism } from '@sentry/utils'; | ||
|
||
/** | ||
* Add event processor that will override SDK details to point to the serverless SDK instead of Node, | ||
* as well as set correct mechanism type, which should be set to `handled: false`. | ||
* We do it like this, so that we don't introduce any side-effects in this module, which makes it tree-shakeable. | ||
* @param scope Scope that processor should be added to | ||
* @param integration Name of the serverless integration ('AWSLambda', 'GCPFunction', etc) | ||
*/ | ||
export function addServerlessEventProcessor(scope: Scope, integration: string): void { | ||
scope.addEventProcessor(event => { | ||
event.sdk = { | ||
...event.sdk, | ||
name: 'sentry.javascript.serverless', | ||
integrations: [...((event.sdk && event.sdk.integrations) || []), integration], | ||
packages: [ | ||
...((event.sdk && event.sdk.packages) || []), | ||
{ | ||
name: 'npm:@sentry/serverless', | ||
version: SDK_VERSION, | ||
}, | ||
], | ||
version: SDK_VERSION, | ||
}; | ||
|
||
addExceptionMechanism(event, { | ||
handled: false, | ||
}); | ||
|
||
return event; | ||
}); | ||
} |
Oops, something went wrong.