@saplings/quality-browser-runtime
v0.18.0
Published
Collect Web Vitals, browser errors, and optional React commit samples inside an application.
Readme
@saplings/quality-browser-runtime
Collect Web Vitals, browser errors, and optional React commit samples inside an application.
Install
npm install @saplings/quality-browser-runtimeQuick start
import { startFrontendObservability } from '@saplings/quality-browser-runtime';
const stop = startFrontendObservability({
sampleRate: 0.1,
onEvent: (event) => console.debug(event.type),
});
// Call stop() when disposing the instrumentation.API and integration
startFrontendObservability(options?)returns a cleanup function. Choose a sample rate between 0 and 1 and call it once per application mount.- Provide
onEventor a trustedendpointto collect events. Review error fields and telemetry retention for your application. @saplings/quality-browser-runtime/reactexportsSaplingProfiler. Wrap a React subtree with a stableidand optionally collectonSamplecallbacks.
Read the integration guide for configuration and operational details.
Consent and privacy
Set shouldCollect to a function backed by your application's consent state to gate both local collection and delivery. Review and redact error details before forwarding events. This diagnostic runtime is not a complete consent-management or production RUM platform.
startFrontendObservability({
endpoint: '/telemetry',
shouldCollect: () => hasAnalyticsConsent(),
});