Complete guide to configuring the Overseer SDK.
import { init } from '@codmir/overseer';
init({
// Required
dsn: 'https://your-project.codmir.com/overseer',
apiKey: 'osk_...',
service: 'my-app',
environment: 'production',
// Optional
release: '1.0.0',
enabled: true,
debug: false,
});
import { init } from '@codmir/overseer';
const isProduction = process.env.NODE_ENV === 'production';
init({
dsn: process.env.NEXT_PUBLIC_OVERSEER_DSN,
apiKey: process.env.NEXT_PUBLIC_OVERSEER_KEY,
service: 'my-app',
environment: process.env.NODE_ENV,
// Less sampling in development
errorSampleRate: isProduction ? 1 : 0.5,
replaySampleRate: isProduction ? 0.1 : 0,
// Debug in development
debug: !isProduction,
// Only enable in production
enabled: isProduction,
});
init({
dsn: '...',
apiKey: 'osk_...',
service: 'my-app',
environment: 'production',
beforeSend(event) {
// Skip hydration errors
if (event.message?.includes('Hydration')) {
return null;
}
// Skip chunk load errors
if (event.message?.includes('ChunkLoadError')) {
return null;
}
// Sanitize sensitive data
if (event.extra?.password) {
delete event.extra.password;
}
// Modify event
event.tags = {
...event.tags,
customTag: 'value',
};
return event;
},
});
init({
dsn: '...',
apiKey: 'osk_...',
service: 'my-app',
environment: 'production',
// Mask all form inputs
maskAllInputs: true,
// Mask specific elements
maskSelectors: [
'.credit-card',
'[data-sensitive]',
'#ssn-input',
],
});
// instrumentation-client.ts
import * as Overseer from '@codmir/overseer/nextjs';
Overseer.init({
dsn: process.env.NEXT_PUBLIC_OVERSEER_DSN,
apiKey: process.env.NEXT_PUBLIC_OVERSEER_KEY,
environment: process.env.NODE_ENV,
release: process.env.NEXT_PUBLIC_APP_VERSION,
// Next.js specific
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
beforeSend(event) {
// Filter framework noise
if (event.message?.includes('Text content does not match')) {
return null;
}
return event;
},
});
// jest.setup.ts or vitest.setup.ts
import { init } from '@codmir/overseer';
init({
dsn: 'test',
apiKey: 'osk_...',
service: 'test',
environment: 'test',
enabled: false, // Disable in tests
});