Skip to content

Commit b5dfa28

Browse files
author
Luca Forstner
committed
esm compat
1 parent 8304869 commit b5dfa28

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

  • packages/node/src/integrations/tracing

packages/node/src/integrations/tracing/prisma.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
import type { Instrumentation } from '@opentelemetry/instrumentation';
2-
// When importing CJS modules into an ESM module, we cannot import the named exports directly.
3-
import * as prismaInstrumentation from '@prisma/instrumentation';
2+
import { PrismaInstrumentation } from '@prisma/instrumentation';
43
import { consoleSandbox, defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON } from '@sentry/core';
54
import { generateInstrumentOnce } from '../../otel/instrument';
65
import type { PrismaV5TracingHelper } from './prisma/vendor/v5-tracing-helper';
76
import type { PrismaV6TracingHelper } from './prisma/vendor/v6-tracing-helper';
87

98
const INTEGRATION_NAME = 'Prisma';
109

11-
const EsmInteropPrismaInstrumentation: typeof prismaInstrumentation.PrismaInstrumentation =
12-
// @ts-expect-error We need to do the following for interop reasons
13-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
14-
prismaInstrumentation.default?.PrismaInstrumentation || prismaInstrumentation.PrismaInstrumentation;
15-
1610
type CompatibilityLayerTraceHelper = PrismaV5TracingHelper & PrismaV6TracingHelper;
1711

1812
function isPrismaV6TracingHelper(helper: unknown): helper is PrismaV6TracingHelper {
@@ -31,7 +25,7 @@ function getPrismaTracingHelper(): unknown | undefined {
3125
return prismaTracingHelper;
3226
}
3327

34-
class SentryPrismaInteropInstrumentation extends EsmInteropPrismaInstrumentation {
28+
class SentryPrismaInteropInstrumentation extends PrismaInstrumentation {
3529
public constructor() {
3630
super();
3731
}

0 commit comments

Comments
 (0)