-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(nuxt): Set transaction name for server error #13292
Conversation
@@ -14,9 +14,17 @@ export default defineNitroPlugin(nitroApp => { | |||
} | |||
} | |||
|
|||
const currentScope = Sentry.getCurrentScope(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: Is there a particular reason you're creating a binding for the current scope here instead of just calling getCurrentScope().setTransactionName()
directly?
const { method, path } = { | ||
method: errorContext.event && errorContext.event._method ? errorContext.event._method : '', | ||
path: errorContext.event && errorContext.event._path ? errorContext.event._path : 'unknown-path', | ||
}; | ||
currentScope.setTransactionName(`${method} ${path}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m: I recommend not setting the transaction name at all if the path is unknown, because we will give other sensible default mechanisms to activate and show in the product, ie. root span name, or stack trace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes!
@@ -1,4 +1,4 @@ | |||
import { captureException } from '@sentry/node'; | |||
import * as Sentry from '@sentry/node'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super-l/hint: It's totally fine to make a namespace (import * as
) or named imports. No need to change it back, just fyi :)
Setting the transaction name to display the API route where the error happened:
