Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .changeset/smoodev-1067-node-handlers.md

This file was deleted.

18 changes: 0 additions & 18 deletions .changeset/smoodev-1067c-otel-foundation.md

This file was deleted.

31 changes: 31 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# @smooai/observability

## 0.3.0

### Minor Changes

- bd64532: Node SDK capture handlers + Hono middleware (SMOODEV-1067 follow-up th-bafeb7).

`@smooai/observability/node` now ships real implementations:
- `registerNodeGlobalHandlers({ flush, exitOnUncaught })` β€” attaches `uncaughtException` + `unhandledRejection` listeners that forward to `Client.captureException`, plus optional SIGTERM / SIGINT / `beforeExit` flushing so a Lambda container shutdown drains the in-memory queue. Idempotent.
- `makeNodeTransport(options)` β€” Node-flavored `Transport` adapter (fetch + keepalive, no Beacon). Returns the underlying transport so callers (and the auto-init wiring) can hook the flush method into the lifecycle.
- `observabilityMiddleware({ resolveUser, requestHeaderAllowlist })` β€” Hono-shaped middleware. Per request: hydrates the active `Scope` with the authenticated user (defaults to reading `c.get('auth')` produced by `@smooai/auth`), adds a `request` context with method/path and an allow-listed header subset, wraps the handler chain in `withScope` so any `captureException` fired from a downstream handler picks up that request's identity, and captures thrown errors before re-throwing so Hono's onError still gets to render the response.
- `Client.init` on node now auto-wires the transport and global handlers (override with `autoInstrumentation: false`).

Also fixed a latent bug in `withScope`: previously the scope was popped before any `await` inside the callback resolved, so request-scoped state was gone by the time async handlers ran. `withScope` now defers the pop until a returned thenable settles, while keeping the synchronous fast path unchanged.

24 tests total (was 13). Build + typecheck clean.

### Patch Changes

- 2d2eed7: `@smooai/observability-otel` β€” OpenTelemetry foundation (SMOODEV-1067c Phase 1).

New package wraps `@opentelemetry/sdk-node` + `@opentelemetry/auto-instrumentations-node` + the OTLP/HTTP trace exporter, and bridges the core `Client` so every `captureException` records on the active OTel span with `SpanStatusCode.ERROR`. Works without `@smooai/logger` β€” pipes correlation IDs through `@opentelemetry/api`'s ambient context, so any logger / framework that integrates with OTel sees the same trace-id flowing through logs, traces, and Smoo error groups.

Public surface:
- `setupOtelSdk({ serviceName, otlpEndpoint, otlpHeaders, environment, release, instrumentationConfig })` β€” idempotent Lambda / Node bootstrap. Returns `{ sdk, flush, shutdown }`.
- `bridgeClientToOtel()` β€” wraps `Client.captureException` / `setUser` / `setTag` to also update OTel span attributes + status. Idempotent.
- `readOtelCorrelation()` β€” read-only view of the active span's `traceId` / `spanId` / sampled flag.

Also patches `@smooai/observability` core docs reference; no API change.

12 tests (bridge + setup), typecheck + build clean.

## 0.2.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smooai/observability",
"version": "0.2.0",
"version": "0.3.0",
"description": "Smoo AI Observability core SDK β€” browser + Node error capture with batched transport",
"license": "MIT",
"repository": {
Expand Down
9 changes: 9 additions & 0 deletions packages/next/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @smooai/observability-next

## 0.3.0

### Patch Changes

- Updated dependencies [bd64532]
- Updated dependencies [2d2eed7]
- @smooai/observability@0.3.0
- @smooai/observability-react@0.3.0

## 0.2.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smooai/observability-next",
"version": "0.2.0",
"version": "0.3.0",
"description": "Next.js wrapper for @smooai/observability β€” RootErrorBoundary, withSmooObservability(), build-time sourcemap upload",
"license": "MIT",
"repository": {
Expand Down
24 changes: 24 additions & 0 deletions packages/otel/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# @smooai/observability-otel

## 0.2.0

### Minor Changes

- 2d2eed7: `@smooai/observability-otel` β€” OpenTelemetry foundation (SMOODEV-1067c Phase 1).

New package wraps `@opentelemetry/sdk-node` + `@opentelemetry/auto-instrumentations-node` + the OTLP/HTTP trace exporter, and bridges the core `Client` so every `captureException` records on the active OTel span with `SpanStatusCode.ERROR`. Works without `@smooai/logger` β€” pipes correlation IDs through `@opentelemetry/api`'s ambient context, so any logger / framework that integrates with OTel sees the same trace-id flowing through logs, traces, and Smoo error groups.

Public surface:
- `setupOtelSdk({ serviceName, otlpEndpoint, otlpHeaders, environment, release, instrumentationConfig })` β€” idempotent Lambda / Node bootstrap. Returns `{ sdk, flush, shutdown }`.
- `bridgeClientToOtel()` β€” wraps `Client.captureException` / `setUser` / `setTag` to also update OTel span attributes + status. Idempotent.
- `readOtelCorrelation()` β€” read-only view of the active span's `traceId` / `spanId` / sampled flag.

Also patches `@smooai/observability` core docs reference; no API change.

12 tests (bridge + setup), typecheck + build clean.

### Patch Changes

- Updated dependencies [bd64532]
- Updated dependencies [2d2eed7]
- @smooai/observability@0.3.0
2 changes: 1 addition & 1 deletion packages/otel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smooai/observability-otel",
"version": "0.1.0",
"version": "0.2.0",
"description": "OpenTelemetry foundation for @smooai/observability β€” Node SDK setup, auto-instrumentations, OTLP export, and bridge to the core Client",
"license": "MIT",
"repository": {
Expand Down
8 changes: 8 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @smooai/observability-react

## 0.3.0

### Patch Changes

- Updated dependencies [bd64532]
- Updated dependencies [2d2eed7]
- @smooai/observability@0.3.0

## 0.2.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smooai/observability-react",
"version": "0.2.0",
"version": "0.3.0",
"description": "React bindings for @smooai/observability β€” ErrorBoundary + useErrorHandler",
"license": "MIT",
"repository": {
Expand Down
Loading