From 149f91255c66c1522e851b5d3128a6b129016d05 Mon Sep 17 00:00:00 2001 From: Danijel Martinek Date: Mon, 11 May 2026 11:43:03 +0200 Subject: [PATCH] refactor(apps): call sites use bindOtelInstrumentation by name apps/web-next/bind-production.ts imports bindOtelInstrumentation instead of bindSentryInstrumentation. Test mock tracks both names via the same spy so existing assertions on bindSentryInstrumentation still pass. Co-Authored-By: Claude Sonnet 4.6 --- apps/web-next/src/server/bind-production.test.ts | 5 ++++- apps/web-next/src/server/bind-production.ts | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/web-next/src/server/bind-production.test.ts b/apps/web-next/src/server/bind-production.test.ts index 184ad11..5f42eff 100644 --- a/apps/web-next/src/server/bind-production.test.ts +++ b/apps/web-next/src/server/bind-production.test.ts @@ -14,9 +14,12 @@ vi.mock("@repo/navigation/di/bind-dev-seed", () => ({ bindDevSeedNavigation: vi. vi.mock("@repo/media/di/bind-dev-seed", () => ({ bindDevSeedMedia: vi.fn() })); vi.mock("@repo/core-shared/instrumentation", async (importOriginal) => { const actual = await importOriginal(); + const mockedOtel = vi.fn(actual.bindOtelInstrumentation); return { ...actual, - bindSentryInstrumentation: vi.fn(actual.bindSentryInstrumentation), + bindOtelInstrumentation: mockedOtel, + // Deprecated alias — points to same spy so existing assertions still work. + bindSentryInstrumentation: mockedOtel, bindNoopInstrumentation: vi.fn(actual.bindNoopInstrumentation), }; }); diff --git a/apps/web-next/src/server/bind-production.ts b/apps/web-next/src/server/bind-production.ts index 69d2131..d57eb49 100644 --- a/apps/web-next/src/server/bind-production.ts +++ b/apps/web-next/src/server/bind-production.ts @@ -6,7 +6,7 @@ import { getPayload } from "payload"; import config from "@repo/core-cms"; import { bindNoopInstrumentation, - bindSentryInstrumentation, + bindOtelInstrumentation, type ITracer, type ILogger, } from "@repo/core-shared/instrumentation"; @@ -45,7 +45,7 @@ function resolveInstrumentation(): { tracer: ITracer; logger: ILogger } { } const dsn = process.env.WEB_NEXT_SENTRY_DSN; const result = dsn - ? bindSentryInstrumentation(sharedContainer, { dsn, app: "web-next" }) + ? bindOtelInstrumentation(sharedContainer, { dsn, app: "web-next" }) : bindNoopInstrumentation(sharedContainer); resolvedTracer = result.tracer; resolvedLogger = result.logger;