diff --git a/.changeset/smoodev-1067-node-handlers.md b/.changeset/smoodev-1067-node-handlers.md deleted file mode 100644 index 61e5c2c..0000000 --- a/.changeset/smoodev-1067-node-handlers.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -'@smooai/observability': minor ---- - -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. diff --git a/.changeset/smoodev-1067c-otel-foundation.md b/.changeset/smoodev-1067c-otel-foundation.md deleted file mode 100644 index d104519..0000000 --- a/.changeset/smoodev-1067c-otel-foundation.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -'@smooai/observability-otel': minor -'@smooai/observability': patch ---- - -`@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. diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index a84d7ae..ebdc916 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -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 diff --git a/packages/core/package.json b/packages/core/package.json index 9829303..48881b4 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -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": { diff --git a/packages/next/CHANGELOG.md b/packages/next/CHANGELOG.md index c369cc8..78a77e5 100644 --- a/packages/next/CHANGELOG.md +++ b/packages/next/CHANGELOG.md @@ -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 diff --git a/packages/next/package.json b/packages/next/package.json index 4b38632..1231c6b 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -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": { diff --git a/packages/otel/CHANGELOG.md b/packages/otel/CHANGELOG.md new file mode 100644 index 0000000..0ad9c72 --- /dev/null +++ b/packages/otel/CHANGELOG.md @@ -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 diff --git a/packages/otel/package.json b/packages/otel/package.json index fff824a..8fcc0c3 100644 --- a/packages/otel/package.json +++ b/packages/otel/package.json @@ -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": { diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index ff76151..4600dca 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -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 diff --git a/packages/react/package.json b/packages/react/package.json index 89510e5..3f62c9a 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -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": {