mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-09 07:16:03 +00:00
Merge pull request #2726 from overleaf/as-improve-sentry-reporting
Improve sentry reporting and ignore very noisy error GitOrigin-RevId: fb31c11eeb4bd9f5d231b5b3148e44a3cc4263eb
This commit is contained in:
parent
cc34a1b867
commit
fd092ee2ad
2 changed files with 27 additions and 2 deletions
|
@ -1,6 +1,8 @@
|
|||
// Conditionally enable Sentry based on whether the DSN token is set
|
||||
if (window.ExposedSettings.sentryDsn) {
|
||||
import(/* webpackChunkName: "sentry" */ '@sentry/browser').then(Sentry => {
|
||||
let eventCount = 0
|
||||
|
||||
Sentry.init({
|
||||
dsn: window.ExposedSettings.sentryDsn,
|
||||
|
||||
|
@ -9,7 +11,30 @@ if (window.ExposedSettings.sentryDsn) {
|
|||
whitelistUrls: [
|
||||
/https:\/\/[a-z]+\.overleaf\.com/,
|
||||
/https:\/\/[a-z]+\.sharelatex\.com/
|
||||
]
|
||||
],
|
||||
|
||||
ignoreErrors: [
|
||||
// Ignore very noisy error
|
||||
'SecurityError: Permission denied to access property "pathname" on cross-origin object'
|
||||
],
|
||||
|
||||
beforeSend(event) {
|
||||
// Limit number of events sent to Sentry to 100 events "per page load",
|
||||
// (i.e. the cap will be reset if the page is reloaded). This prevent
|
||||
// hitting their server-side event cap.
|
||||
eventCount++
|
||||
if (eventCount > 100) {
|
||||
return null // Block the event from sending
|
||||
} else {
|
||||
return event
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Sentry.configureScope(scope => {
|
||||
if (window.user_id.length) {
|
||||
scope.setUser(window.user_id)
|
||||
}
|
||||
})
|
||||
|
||||
// Previously Raven added itself as a global, so we mimic that old behaviour
|
||||
|
|
|
@ -16,7 +16,7 @@ module.exports = merge.smart(
|
|||
mode: 'production',
|
||||
|
||||
// Enable a full source map. Generates a comment linking to the source map
|
||||
devtool: 'source-map',
|
||||
devtool: 'hidden-source-map',
|
||||
|
||||
output: {
|
||||
// Override filename to include hash for immutable caching
|
||||
|
|
Loading…
Add table
Reference in a new issue