forked from Bloomstack/frappe-sentry
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rohan Bansal
committed
Nov 30, 2023
1 parent
24a366f
commit f00a1c0
Showing
7 changed files
with
95 additions
and
105 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,7 @@ ignore = | |
F841, | ||
E713, | ||
E712, | ||
B028, | ||
|
||
max-line-length = 200 | ||
exclude=,test_*.py |
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 |
---|---|---|
@@ -1,39 +1,38 @@ | ||
import * as Sentry from '@sentry/browser' | ||
import { CaptureConsole, Offline } from '@sentry/integrations' | ||
import { Integrations } from "@sentry/tracing" | ||
import * as Sentry from "@sentry/browser"; | ||
import { CaptureConsole } from "@sentry/integrations"; | ||
|
||
if (frappe.boot.sentry?.dsn) { | ||
Sentry.init( | ||
{ | ||
dsn: frappe.boot.sentry.dsn, | ||
integrations: [ | ||
new Integrations.BrowserTracing({ | ||
beforeNavigate: context => { | ||
const route = frappe.router.current_route | ||
// get a shallow copy of the route to avoid modifying cache | ||
? frappe.get_route().slice() | ||
: ["app"]; | ||
Sentry.init({ | ||
dsn: frappe.boot.sentry.dsn, | ||
transport: Sentry.makeBrowserOfflineTransport(Sentry.makeFetchTransport), | ||
transportOptions: { maxQueueSize: 25 }, | ||
integrations: [ | ||
new Sentry.BrowserTracing({ | ||
beforeNavigate: (context) => { | ||
const route = frappe.router.current_route | ||
? frappe.get_route().slice() // get a shallow copy of the route to avoid modifying cache | ||
: ["app"]; | ||
|
||
if (route[0].toLowerCase() === "form") { | ||
route[2] = "<ID>"; | ||
} | ||
|
||
return { | ||
...context, | ||
name: route.join("/") | ||
} | ||
if (route[0].toLowerCase() === "form") { | ||
route[2] = "<ID>"; | ||
} | ||
}), | ||
new CaptureConsole({ levels: ['warn', 'error', 'debug'] }), | ||
new Offline({ maxStoredEvents: 25 }) | ||
], | ||
tracesSampleRate: 1.0, // adjust value once we're live | ||
}); | ||
|
||
Sentry.configureScope(scope => { | ||
scope.setUser({ email: frappe.boot.user.email }) | ||
scope.setTag("site", frappe.boot.sentry.site) | ||
scope.setTag("project", frappe.boot.sentry.project) | ||
scope.setTag("server_name", frappe.boot.sentry.server_name) | ||
}) | ||
} | ||
return { | ||
...context, | ||
name: route.join("/"), | ||
}; | ||
}, | ||
}), | ||
new CaptureConsole({ levels: ["warn", "error", "debug"] }), | ||
], | ||
tracesSampleRate: 0.5, | ||
profilesSampleRate: 0.5, | ||
}); | ||
|
||
Sentry.configureScope((scope) => { | ||
scope.setUser({ email: frappe.boot.user.email }); | ||
scope.setTag("site", frappe.boot.sentry.site); | ||
scope.setTag("project", frappe.boot.sentry.project); | ||
scope.setTag("server_name", frappe.boot.sentry.server_name); | ||
}); | ||
} |
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 |
---|---|---|
|
@@ -2,67 +2,65 @@ | |
# yarn lockfile v1 | ||
|
||
|
||
"@sentry/browser@^7.28.1": | ||
version "7.28.1" | ||
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.28.1.tgz#c8086e26079809aa401a05d9b4a6e4df63a9c965" | ||
integrity sha512-N8j93IcrWKWorfJ5D+RSKVAvcR4S5tIcZ/HvFPMrQWnfVa/jtJcrKThdjZYteA0wjmPiy8/D3KA8nB91yulBPA== | ||
"@sentry-internal/[email protected]": | ||
version "7.83.0" | ||
resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.83.0.tgz#8f69d339569b020c495f8350a8ea527c369586e8" | ||
integrity sha512-fY1ZyOiQaaUTuoq5rO+G4/5Ov3n8BnfNK7ck97yAGxy3w+E1CwhVZkXHEvTngNfdYV3ArxvlrtPRb9STFRqXvQ== | ||
dependencies: | ||
"@sentry/core" "7.28.1" | ||
"@sentry/replay" "7.28.1" | ||
"@sentry/types" "7.28.1" | ||
"@sentry/utils" "7.28.1" | ||
tslib "^1.9.3" | ||
"@sentry/core" "7.83.0" | ||
"@sentry/types" "7.83.0" | ||
"@sentry/utils" "7.83.0" | ||
|
||
"@sentry/[email protected]": | ||
version "7.28.1" | ||
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.28.1.tgz#c712ce17469b18b01606108817be24a99ed2116e" | ||
integrity sha512-7wvnuvn/mrAfcugWoCG/3pqDIrUgH5t+HisMJMGw0h9Tc33KqrmqMDCQVvjlrr2pWrw/vuUCFdm8CbUHJ832oQ== | ||
"@sentry/browser@^7.83.0": | ||
version "7.83.0" | ||
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.83.0.tgz#01e8ba0d3f4d4652e67c8b0d955d2f3903a19ab0" | ||
integrity sha512-8v7QEaC/fVAHn8pi59ZlJznr7ZdOQIgtz8DAOJeJsC2vHTAxQ9nVkoMkJWjTp/qaDHUjSe5ob6eqaChuhi6t2g== | ||
dependencies: | ||
"@sentry/types" "7.28.1" | ||
"@sentry/utils" "7.28.1" | ||
tslib "^1.9.3" | ||
"@sentry-internal/tracing" "7.83.0" | ||
"@sentry/core" "7.83.0" | ||
"@sentry/replay" "7.83.0" | ||
"@sentry/types" "7.83.0" | ||
"@sentry/utils" "7.83.0" | ||
|
||
"@sentry/integrations@^7.28.1": | ||
version "7.28.1" | ||
resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-7.28.1.tgz#f0cba627b9ed03f1a54d91385126019f332a575d" | ||
integrity sha512-opeXVR1L9mZmZcpAs9kX+4JPY7pXhVupy17Sbz+43zd5CshYTveIcttGNPp+EPT3j7mMU+1TMAYZspKqJXtEBQ== | ||
"@sentry/[email protected]": | ||
version "7.83.0" | ||
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.83.0.tgz#29bdd5aba40a6f25c01c68387b6a9aa13e27f20a" | ||
integrity sha512-fglvpw8aWM6nWXzCjAVXIMTiTEAQ9G9b85IpDd/7L8fuwaFTPQAUSJXupF2PfbpQ3FUYbJt80dxshbERVJG8vQ== | ||
dependencies: | ||
"@sentry/types" "7.28.1" | ||
"@sentry/utils" "7.28.1" | ||
localforage "^1.8.1" | ||
tslib "^1.9.3" | ||
"@sentry/types" "7.83.0" | ||
"@sentry/utils" "7.83.0" | ||
|
||
"@sentry/[email protected]": | ||
version "7.28.1" | ||
resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.28.1.tgz#fbdd377923e082423b95e3f128cb9af9451aca70" | ||
integrity sha512-Os0PzMjKlwtHwzTU0kfVzGzsi4Vaj3g2arCl4Qnr3b6kYTb9WOFZo/n/v56ss7Z+nZG3K8W5PisoD4MRsRJRig== | ||
"@sentry/integrations@^7.83.0": | ||
version "7.83.0" | ||
resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-7.83.0.tgz#c9256bd6168bef587e4bde04b66609aaea16a3ab" | ||
integrity sha512-KyptWUyg/Z+3qN1dBDDVcNNUzIwWpCO3mfiToV20LSeA+e/NS4IWTtsZKo2mqvoQQ/4QKcrMj7NbF5iOjKckaQ== | ||
dependencies: | ||
"@sentry/core" "7.28.1" | ||
"@sentry/types" "7.28.1" | ||
"@sentry/utils" "7.28.1" | ||
"@sentry/core" "7.83.0" | ||
"@sentry/types" "7.83.0" | ||
"@sentry/utils" "7.83.0" | ||
localforage "^1.8.1" | ||
|
||
"@sentry/tracing@^7.28.1": | ||
version "7.28.1" | ||
resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-7.28.1.tgz#d276e4d17a79190a88112696c73de12c209607a1" | ||
integrity sha512-uWspnuz+7FyW8ES5lRaVA7O/YJSzMlSkvBFtgzaoKmdaueokU/sRLwlCsrdgwavG1wpm79df7R1iiSeqhaXDlw== | ||
"@sentry/[email protected]": | ||
version "7.83.0" | ||
resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.83.0.tgz#14fd39a638911f60b780d232d2056f0d19ed478e" | ||
integrity sha512-B/rzmjmQ3ZWE68m4Z9rHIN3Fa/wkfVVTK+iSQtqErFflyMETMNwtWRNd6P9FhXnphEINZEbcn/UZF5w5xu/DfA== | ||
dependencies: | ||
"@sentry/core" "7.28.1" | ||
"@sentry/types" "7.28.1" | ||
"@sentry/utils" "7.28.1" | ||
tslib "^1.9.3" | ||
"@sentry-internal/tracing" "7.83.0" | ||
"@sentry/core" "7.83.0" | ||
"@sentry/types" "7.83.0" | ||
"@sentry/utils" "7.83.0" | ||
|
||
"@sentry/types@7.28.1": | ||
version "7.28.1" | ||
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.28.1.tgz#9018b4c152b475de9bedd267237393d3c9b1253d" | ||
integrity sha512-DvSplMVrVEmOzR2M161V5+B8Up3vR71xMqJOpWTzE9TqtFJRGPtqT/5OBsNJJw1+/j2ssMcnKwbEo9Q2EGeS6g== | ||
"@sentry/types@7.83.0": | ||
version "7.83.0" | ||
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.83.0.tgz#117e45900603190c547e52bba35e1b3d539d47fb" | ||
integrity sha512-Bd+zJcy8p1VgCfQqUprmUaw0QPWUV+GmCt6zJRHrHTb2pwLahXv6sHJvQ8F8Va6S7Keuy088U+kHzUFGQLMZMQ== | ||
|
||
"@sentry/utils@7.28.1": | ||
version "7.28.1" | ||
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.28.1.tgz#0a7b6aa4b09e91e4d1aded2a8c8dbaf818cee96e" | ||
integrity sha512-75/jzLUO9HH09iC9TslNimGbxOP3jgn89P+q7uR+rp2fJfRExHVeKJZQdK0Ij4/SmE7TJ3Uh2r154N0INZEx1g== | ||
"@sentry/utils@7.83.0": | ||
version "7.83.0" | ||
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.83.0.tgz#ec0fc0a468ec35ab9623603f1ba218dd58233eda" | ||
integrity sha512-7SrZtgAn3pHFBqSSvV/VL0CWTBQ7VenJjok4+WGWd6/FhP3fKrEEd9rjVTUb2Pzq9WLJJYzdvxAG8RlggG+H4g== | ||
dependencies: | ||
"@sentry/types" "7.28.1" | ||
tslib "^1.9.3" | ||
"@sentry/types" "7.83.0" | ||
|
||
immediate@~3.0.5: | ||
version "3.0.6" | ||
|
@@ -82,8 +80,3 @@ localforage@^1.8.1: | |
integrity sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg== | ||
dependencies: | ||
lie "3.1.1" | ||
|
||
tslib@^1.9.3: | ||
version "1.14.1" | ||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" | ||
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== |