Configure the Overseer SDK
Configuration
Complete guide to configuring the Overseer SDK.
Basic Configuration
import { init } from '@codmir/overseer';
init({
// Required
dsn: 'https://your-project.codmir.com/overseer',
service: 'my-app',
environment: 'production',
// Optional
release: '1.0.0',
enabled: true,
debug: false,
});All Options
Core Options
| Option | Type | Default | Description |
|---|---|---|---|
dsn | string | Required | Overseer endpoint URL |
service | string | Required | Service/app name for grouping |
environment | string | Required | Environment name |
release | string | - | App version for release tracking |
enabled | boolean | true | Enable/disable the SDK |
debug | boolean | false | Enable debug console logging |
Sampling
| Option | Type | Default | Description |
|---|---|---|---|
errorSampleRate | number | 1 | Percentage of errors to capture (0-1) |
tracesSampleRate | number | 1 | Percentage of transactions to trace (0-1) |
Session Replay
| Option | Type | Default | Description |
|---|---|---|---|
enableReplay | boolean | true | Enable session replay |
replaySampleRate | number | 0.1 | Percentage of sessions to record (0-1) |
replayOnErrorSampleRate | number | 1.0 | Percentage of error sessions to record (0-1) |
Privacy
| Option | Type | Default | Description |
|---|---|---|---|
maskAllInputs | boolean | false | Mask all form input values |
maskSelectors | string[] | [] | CSS selectors to mask content |
Performance
| Option | Type | Default | Description |
|---|---|---|---|
enablePerformance | boolean | true | Enable performance tracking |
Transport
| Option | Type | Default | Description |
|---|---|---|---|
maxBatchSize | number | 50 | Max events per batch |
flushInterval | number | 5000 | Flush interval in ms |
Environment-Based Config
import { init } from '@codmir/overseer';
const isProduction = process.env.NODE_ENV === 'production';
init({
dsn: process.env.NEXT_PUBLIC_OVERSEER_DSN,
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,
});Filtering Events
Use beforeSend to filter or modify events:
init({
dsn: '...',
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;
},
});Privacy Configuration
Mask sensitive content in session replay:
init({
dsn: '...',
service: 'my-app',
environment: 'production',
// Mask all form inputs
maskAllInputs: true,
// Mask specific elements
maskSelectors: [
'.credit-card',
'[data-sensitive]',
'#ssn-input',
],
});Next.js Configuration
// instrumentation-client.ts
import * as Overseer from '@codmir/overseer/nextjs';
Overseer.init({
dsn: process.env.NEXT_PUBLIC_OVERSEER_DSN,
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;
},
});Disabling in Tests
// jest.setup.ts or vitest.setup.ts
import { init } from '@codmir/overseer';
init({
dsn: 'test',
service: 'test',
environment: 'test',
enabled: false, // Disable in tests
});