feat: integrate observability
This commit is contained in:
26
packages/next-observability/src/errors/sentry.ts
Normal file
26
packages/next-observability/src/errors/sentry.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import * as Sentry from "@sentry/nextjs";
|
||||
|
||||
export interface SentryConfig {
|
||||
dsn?: string;
|
||||
enabled?: boolean;
|
||||
tracesSampleRate?: number;
|
||||
tunnel?: string;
|
||||
replaysOnErrorSampleRate?: number;
|
||||
replaysSessionSampleRate?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Standardized Sentry initialization for Mintel projects.
|
||||
*/
|
||||
export function initSentry(config: SentryConfig) {
|
||||
Sentry.init({
|
||||
dsn: config.dsn,
|
||||
enabled: config.enabled ?? Boolean(config.dsn || config.tunnel),
|
||||
tracesSampleRate: config.tracesSampleRate ?? 0,
|
||||
tunnel: config.tunnel,
|
||||
replaysOnErrorSampleRate: config.replaysOnErrorSampleRate ?? 1.0,
|
||||
replaysSessionSampleRate: config.replaysSessionSampleRate ?? 0.1,
|
||||
});
|
||||
}
|
||||
|
||||
export { Sentry };
|
||||
Reference in New Issue
Block a user