refactor(core-shared): delete Sentry scrub + orphaned server-init files (replaced by OTel processors)

This commit is contained in:
2026-05-11 12:12:12 +02:00
parent ad609f8f01
commit 301e0ff3f8
12 changed files with 168 additions and 234 deletions

View File

@@ -1,11 +1,14 @@
// packages/core-shared/src/instrumentation/sentry/init-server-node.ts
// NOTE: PII scrubbing is now handled at the OTel pipeline layer via PiiScrubSpanProcessor
// and PiiScrubLogRecordProcessor (see otel/pii-scrub-processor.ts). The beforeSend /
// beforeSendTransaction hooks are no longer needed here (R32, R33 still enforced at OTel layer).
import * as SentryNode from "@sentry/node";
import { beforeSend, beforeSendTransaction } from "./scrub";
import type { InitServerOpts } from "./init-server";
/**
* Server-side init for non-Next.js runtimes (TanStack Start). Mirrors
* init-server.ts but uses @sentry/node directly. R31, R32, R33 still apply.
* init-server.ts but uses @sentry/node directly. R31, R32, R33 still apply
* (scrubbing enforced at the OTel processor layer before data reaches Sentry).
*/
export function initSentryServerNode(opts: InitServerOpts): void {
if (!opts.dsn) return;
@@ -25,16 +28,13 @@ export function initSentryServerNode(opts: InitServerOpts): void {
"development";
const release = opts.release ?? process.env["VITE_GIT_COMMIT_SHA"] ?? "unknown";
type InitOpts = Parameters<typeof SentryNode.init>[0];
SentryNode.init({
dsn: opts.dsn,
environment,
release,
tracesSampleRate,
sendDefaultPii: false, // R31
beforeSend: beforeSend as unknown as NonNullable<InitOpts>["beforeSend"], // R32
beforeSendTransaction:
beforeSendTransaction as unknown as NonNullable<InitOpts>["beforeSendTransaction"], // R33
// R32, R33: PII scrubbing happens at the OTel processor layer before data reaches Sentry.
initialScope: { tags: { app: opts.app } },
});
}