fix(otel): consolidate to single OTel SDK init at instrumentation.register hook

All three apps' instrumentation.ts files now call initOtelServerNode directly
instead of initSentryServer/initSentryServerNode, closing the startup window
where @sentry/nextjs auto-instrumentation could send unscrubbed errors before
bindAll() fires. bindOtelInstrumentation no longer calls initOtelServerNode
(SDK init belongs at app boot, binding at request scope). Orphaned sentry/
init-server*.ts files deleted; their package.json subpath exports removed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-11 12:38:17 +02:00
parent 05524dfcea
commit 4ea9a5c38e
11 changed files with 54 additions and 288 deletions

View File

@@ -1,9 +1,12 @@
// apps/web-tanstack/src/instrumentation.ts
// Server-entry hook. Imported at the top of the server entry file.
import { initSentryServerNode } from "@repo/core-shared/instrumentation/sentry/init-server-node";
// Server-entry hook. Imported at the top of the server entry file before any
// request handler runs. Initializes the OTel SDK here so PII scrub processors
// are active from the very first request (C1 fix — closes the startup window
// where Sentry auto-instrumentation could send unscrubbed errors).
import { initOtelServerNode } from "@repo/core-shared/instrumentation/otel/init-server-node";
initSentryServerNode({
dsn: process.env["WEB_TANSTACK_SENTRY_DSN"],
app: "web-tanstack",
release: process.env["VITE_GIT_COMMIT_SHA"],
initOtelServerNode({
dsn: process.env["WEB_TANSTACK_SENTRY_DSN"] ?? "",
serviceName: "web-tanstack",
environment: process.env["NODE_ENV"] ?? "development",
});