feat: sentry updates

This commit is contained in:
pablodanswer 2024-10-26 11:48:19 -07:00
parent 5e01d6befb
commit 3ea65c0216
10 changed files with 33 additions and 41 deletions

View File

@ -36,7 +36,7 @@ if SENTRY_DSN:
sentry_sdk.init(
dsn=SENTRY_DSN,
integrations=[CeleryIntegration()],
traces_sample_rate=0.5,
traces_sample_rate=0.1,
)
logger.info("Sentry initialized")
else:

View File

@ -134,7 +134,6 @@ try:
except ValueError:
INDEX_BATCH_SIZE = 16
# Below are intended to match the env variables names used by the official postgres docker image
# https://hub.docker.com/_/postgres
POSTGRES_USER = os.environ.get("POSTGRES_USER") or "postgres"

View File

@ -213,7 +213,7 @@ def get_application() -> FastAPI:
sentry_sdk.init(
dsn=SENTRY_DSN,
integrations=[StarletteIntegration(), FastApiIntegration()],
traces_sample_rate=0.5,
traces_sample_rate=0.1,
)
logger.info("Sentry initialized")
else:

View File

@ -89,7 +89,7 @@ def get_model_app() -> FastAPI:
sentry_sdk.init(
dsn=SENTRY_DSN,
integrations=[StarletteIntegration(), FastApiIntegration()],
traces_sample_rate=0.5,
traces_sample_rate=0.1,
)
logger.info("Sentry initialized")
else:

View File

@ -15,12 +15,15 @@ const nextConfig = {
const { withSentryConfig } = require("@sentry/nextjs");
// Sentry configuration for error monitoring:
// - Without SENTRY_AUTH_TOKEN and NEXT_PUBLIC_SENTRY_DSN: Sentry is completely disabled
// - With both configured: Only unhandled errors are captured (no performance/session tracking)
module.exports = withSentryConfig(nextConfig, {
org: "danswer",
project: "javascript-nextjs",
// An auth token is required for uploading source maps.
org: process.env.SENTRY_ORG || "danswer",
project: process.env.SENTRY_PROJECT || "data-plane-web",
authToken: process.env.SENTRY_AUTH_TOKEN,
silent: false, // Can be used to suppress logs
silent: false,
sourceMaps: {
skipUpload: !process.env.SENTRY_AUTH_TOKEN,
},
});

View File

@ -3,21 +3,12 @@ import * as Sentry from "@sentry/nextjs";
if (process.env.NEXT_PUBLIC_SENTRY_DSN) {
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
// Replay may only be enabled for the client-side
integrations: [Sentry.replayIntegration()],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for tracing.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
// Capture Replay for 10% of all sessions,
// plus for 100% of sessions with an error
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
// Note: if you want to override the automatic release value, do not set a
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
// that it will also get attached to your source maps
// Only capture unhandled exceptions
enableTracing: false,
integrations: [],
tracesSampleRate: 0,
replaysSessionSampleRate: 0,
replaysOnErrorSampleRate: 0,
autoSessionTracking: false,
});
}

View File

@ -3,14 +3,9 @@ import * as Sentry from "@sentry/nextjs";
if (process.env.NEXT_PUBLIC_SENTRY_DSN) {
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for tracing.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
// Note: if you want to override the automatic release value, do not set a
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
// that it will also get attached to your source maps
// Only capture unhandled exceptions
tracesSampleRate: 0,
enableTracing: false,
autoSessionTracking: false,
});
}

View File

@ -4,10 +4,12 @@ if (process.env.NEXT_PUBLIC_SENTRY_DSN) {
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for tracing.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
// Only capture unhandled exceptions and errors
tracesSampleRate: 0,
enableTracing: false,
// Disable performance monitoring and only capture errors
profilesSampleRate: 0,
// Note: if you want to override the automatic release value, do not set a
// `release` value here - use the environment variable `SENTRY_RELEASE`, so

View File

@ -50,7 +50,6 @@ import {
useContext,
useEffect,
useLayoutEffect,
useMemo,
useRef,
useState,
} from "react";
@ -2392,6 +2391,7 @@ export function ChatPage({
{/* Some padding at the bottom so the search bar has space at the bottom to not cover the last message*/}
<div ref={endPaddingRef} className="h-[95px]" />
<div ref={endDivRef} />
</div>
</div>

View File

@ -11,7 +11,9 @@ export default function GlobalError({
error: Error & { digest?: string };
}) {
useEffect(() => {
Sentry.captureException(error);
if (process.env.NEXT_PUBLIC_SENTRY_DSN) {
Sentry.captureException(error);
}
}, [error]);
return (