@smooai/observability
v0.11.0
Published
Smoo AI Observability SDK — OTel-first error capture, traces, metrics, and React/Next.js integrations in a single package with subpath exports
Downloads
1,267
Readme
@smooai/observability
Universal browser + Node SDK for Smoo AI Observability. Captures unhandled exceptions, builds a Scope with breadcrumbs and user context, redacts PII, and ships batched events to a Smoo ingest endpoint.
pnpm add @smooai/observabilityEntry points
| Import | Runtime |
| ------------------------------- | ------------------------------------------ |
| @smooai/observability | Auto-resolved by bundler (browser or node) |
| @smooai/observability/browser | Force browser entry |
| @smooai/observability/node | Force Node entry |
API
Client.init(options)
import { Client } from '@smooai/observability';
Client.init({
dsn: 'https://api.smoo.ai/webhooks/observability/<org>/<token>',
environment: 'production',
release: 'apps/web@abc1234',
flushIntervalMs: 1000,
maxBatchSize: 30,
beforeSend: (event) => (event.tags?.skip ? null : event),
});Capture
Client.captureException(new Error('boom'), { tags: { vendor: 'flaky-co' } });
Client.captureMessage('user reached impossible state', 'warning');Scope
import { withScope, Client } from '@smooai/observability';
withScope((scope) => {
scope.setTag('checkout-step', 'shipping');
scope.addBreadcrumb({ category: 'custom', message: 'started shipping form', level: 'info', timestamp: Date.now() });
// Anything captured inside the closure inherits these.
Client.captureException(err);
});Breadcrumbs
Client.addBreadcrumb('fetch', 'POST /api/checkout 502', { method: 'POST', status: 502 }, 'error');User context
Client.setUser({ id: 'user_abc', orgId: 'org_xyz', sessionId: 'sess_123' });What it does NOT do
- Does not capture
console.log/console.info/console.warn - Does not capture request / response bodies
- Does not capture cookies
- Does not contact any third-party
Status
0.1.0 — types and Client API are stable. Capture handlers and full transport ship in upcoming releases (see SmooAI/smooai SMOODEV-1067).
License
MIT
