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 <noreply@anthropic.com>
This commit is contained in:
@@ -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<typeof import("@repo/core-shared/instrumentation")>();
|
||||
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),
|
||||
};
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user