Pluggable integrations that enhance Sentry JavaScript SDKs with additional error tracking, monitoring, and debugging capabilities.
—
Browser-only integration that captures Reporting API events such as crash reports, deprecation warnings, and intervention reports. This integration helps monitor browser-generated reports about web application issues.
/**
* Reporting API integration for capturing browser reports
* @param options - Configuration for report types to observe
* @returns Integration instance that monitors Reporting API
*/
function reportingObserverIntegration(options?: ReportingObserverOptions): Integration;
interface ReportingObserverOptions {
/** Types of reports to observe */
types?: ReportTypes[];
}
type ReportTypes = 'crash' | 'deprecation' | 'intervention';/**
* Legacy class-based Reporting Observer integration
* @deprecated Use reportingObserverIntegration() instead
*/
class ReportingObserver implements Integration {
constructor(options?: {
types?: ReportTypes[];
});
name: string;
setupOnce(): void;
setup(client: Client): void;
}Generated when the browser detects application crashes:
'crash'Generated when deprecated web features are used:
'deprecation'Generated when browser intervenes to improve user experience:
'intervention'Array of report types to observe:
['crash', 'deprecation', 'intervention'] (all types)['crash', 'deprecation'] (exclude interventions)['crash'] (only crash reports)This integration requires:
interface Report {
[key: string]: unknown;
type: ReportTypes;
url: string;
body?: ReportBody;
}
type ReportBody = CrashReportBody | DeprecationReportBody | InterventionReportBody;
interface CrashReportBody {
[key: string]: unknown;
crashId: string;
reason?: string;
}
interface DeprecationReportBody {
[key: string]: unknown;
id: string;
anticipatedRemoval?: Date;
message: string;
sourceFile?: string;
lineNumber?: number;
columnNumber?: number;
}
interface InterventionReportBody {
[key: string]: unknown;
id: string;
message: string;
sourceFile?: string;
lineNumber?: number;
columnNumber?: number;
}import { reportingObserverIntegration } from '@sentry/integrations';
import * as Sentry from '@sentry/browser';
// Monitor all report types (default)
Sentry.init({
dsn: 'YOUR_DSN',
integrations: [
reportingObserverIntegration()
]
});
// Monitor only crashes and deprecations
Sentry.init({
dsn: 'YOUR_DSN',
integrations: [
reportingObserverIntegration({
types: ['crash', 'deprecation']
})
]
});
// Monitor only crash reports
Sentry.init({
dsn: 'YOUR_DSN',
integrations: [
reportingObserverIntegration({
types: ['crash']
})
]
});Reports are converted to Sentry message events with:
Event Message Format: ReportingObserver [type]: details
ReportingObserver [crash]: crashId reasonReportingObserver [deprecation]: messageReportingObserver [intervention]: messageEvent Context:
extra.url: URL where report was generatedextra.body: Complete report body object// Using deprecated feature triggers report:
document.write('<p>This is deprecated</p>');
// Results in Sentry event:
// "ReportingObserver [deprecation]: Use of document.write() is deprecated"// Slow script triggers intervention:
while(true) { /* infinite loop */ }
// Results in Sentry event:
// "ReportingObserver [intervention]: Long running script was terminated"// Browser crash (simplified example):
// Results in Sentry event:
// "ReportingObserver [crash]: 12345 Out of memory"This integration is particularly valuable for modern web applications that need to stay current with browser changes and maintain optimal performance.
Install with Tessl CLI
npx tessl i tessl/npm-sentry--integrations