add setry
This commit is contained in:
@@ -424,6 +424,10 @@
|
|||||||
<div id="packet-history" class="fullscreen-overlay"></div>
|
<div id="packet-history" class="fullscreen-overlay"></div>
|
||||||
|
|
||||||
<div id="database-error" class="fullscreen-overlay"></div>
|
<div id="database-error" class="fullscreen-overlay"></div>
|
||||||
|
<script
|
||||||
|
src="https://js-de.sentry-cdn.com/017b4494d7038e3e789fe38378b53fb2.min.js"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
></script>
|
||||||
|
|
||||||
<script src="lib/loglevel.min.js"></script>
|
<script src="lib/loglevel.min.js"></script>
|
||||||
<script src="lib/uuidv4.min.js" type="module"></script>
|
<script src="lib/uuidv4.min.js" type="module"></script>
|
||||||
@@ -447,6 +451,7 @@
|
|||||||
<script src="js/main.js" defer="defer" type="module"></script>
|
<script src="js/main.js" defer="defer" type="module"></script>
|
||||||
<script src="lib/notify.min.js" type="text/javascript"></script>
|
<script src="lib/notify.min.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
|
||||||
<script></script>
|
<script></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+45
-16
@@ -1,7 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Sentry Error Monitoring initializer for RTS.
|
* Sentry Error Monitoring initializer for RTS.
|
||||||
*
|
* Optimized for Free Tier with beforeSend noise filtering.
|
||||||
* Configurable via window.SENTRY_DSN or window.RTS_SENTRY_DSN or <meta name="sentry-dsn" content="...">
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function initSentry() {
|
export function initSentry() {
|
||||||
@@ -13,28 +12,58 @@ export function initSentry() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const beforeSend = (event, hint) => {
|
||||||
|
const error = hint?.originalException;
|
||||||
|
const message = event?.message || (error && error.message) || "";
|
||||||
|
|
||||||
|
// Ignore common harmless browser/network noise to preserve Sentry free quota
|
||||||
|
const noisePatterns = [
|
||||||
|
/ResizeObserver loop/i,
|
||||||
|
/Failed to fetch/i,
|
||||||
|
/NetworkError/i,
|
||||||
|
/Load failed/i,
|
||||||
|
/Script error/i,
|
||||||
|
/top.GLOBALS/i,
|
||||||
|
/chrome-extension:\/\//i,
|
||||||
|
/moz-extension:\/\//i,
|
||||||
|
];
|
||||||
|
|
||||||
|
if (noisePatterns.some((pattern) => pattern.test(message))) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return event;
|
||||||
|
};
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
dsn: dsn,
|
||||||
|
environment: window.SENTRY_ENVIRONMENT || "production",
|
||||||
|
tracesSampleRate: parseFloat(window.SENTRY_TRACES_SAMPLE_RATE || "0.02"),
|
||||||
|
beforeSend: beforeSend,
|
||||||
|
ignoreErrors: [
|
||||||
|
"ResizeObserver loop limit exceeded",
|
||||||
|
"ResizeObserver loop completed with undelivered notifications.",
|
||||||
|
"NetworkError when attempting to fetch resource.",
|
||||||
|
"Failed to fetch",
|
||||||
|
"Load failed",
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
if (window.Sentry) {
|
if (window.Sentry) {
|
||||||
window.Sentry.init({
|
window.Sentry.init({
|
||||||
dsn: dsn,
|
...config,
|
||||||
environment: window.SENTRY_ENVIRONMENT || 'production',
|
|
||||||
tracesSampleRate: parseFloat(window.SENTRY_TRACES_SAMPLE_RATE || '0.05'),
|
|
||||||
integrations: [
|
integrations: [
|
||||||
window.Sentry.browserTracingIntegration ? window.Sentry.browserTracingIntegration() : null
|
window.Sentry.browserTracingIntegration ? window.Sentry.browserTracingIntegration() : null,
|
||||||
].filter(Boolean)
|
].filter(Boolean),
|
||||||
});
|
});
|
||||||
console.log("[RTS] Sentry error monitoring initialized");
|
console.log("[RTS] Sentry error monitoring initialized");
|
||||||
} else {
|
} else {
|
||||||
// Dynamically load Sentry bundle if DSN is set but Sentry library tag isn't explicitly loaded
|
const script = document.createElement("script");
|
||||||
const script = document.createElement('script');
|
script.src = "https://browser.sentry-cdn.com/8.48.0/bundle.min.js";
|
||||||
script.src = 'https://browser.sentry-cdn.com/8.48.0/bundle.min.js';
|
script.crossOrigin = "anonymous";
|
||||||
script.crossOrigin = 'anonymous';
|
|
||||||
script.onload = () => {
|
script.onload = () => {
|
||||||
if (window.Sentry) {
|
if (window.Sentry) {
|
||||||
window.Sentry.init({
|
window.Sentry.init(config);
|
||||||
dsn: dsn,
|
|
||||||
environment: window.SENTRY_ENVIRONMENT || 'production',
|
|
||||||
tracesSampleRate: parseFloat(window.SENTRY_TRACES_SAMPLE_RATE || '0.05')
|
|
||||||
});
|
|
||||||
console.log("[RTS] Sentry error monitoring initialized via dynamic load");
|
console.log("[RTS] Sentry error monitoring initialized via dynamic load");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user