Skip to content

Commit 0c983b3

Browse files
authored
feat(node): Add Prisma integration by default (#16073)
1 parent f0e5e2f commit 0c983b3

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

packages/node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"@opentelemetry/resources": "^1.30.1",
9696
"@opentelemetry/sdk-trace-base": "^1.30.1",
9797
"@opentelemetry/semantic-conventions": "^1.30.0",
98-
"@prisma/instrumentation": "6.6.0",
98+
"@prisma/instrumentation": "6.7.0",
9999
"@sentry/core": "9.15.0",
100100
"@sentry/opentelemetry": "9.15.0",
101101
"import-in-the-middle": "^1.13.0"

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { instrumentMongoose, mongooseIntegration } from './mongoose';
1515
import { instrumentMysql, mysqlIntegration } from './mysql';
1616
import { instrumentMysql2, mysql2Integration } from './mysql2';
1717
import { instrumentPostgres, postgresIntegration } from './postgres';
18+
import { prismaIntegration } from './prisma';
1819
import { instrumentRedis, redisIntegration } from './redis';
1920
import { instrumentTedious, tediousIntegration } from './tedious';
2021
import { instrumentVercelAi, vercelAIIntegration } from './vercelai';
@@ -33,10 +34,7 @@ export function getAutoPerformanceIntegrations(): Integration[] {
3334
mysql2Integration(),
3435
redisIntegration(),
3536
postgresIntegration(),
36-
// For now, we do not include prisma by default because it has ESM issues
37-
// See https://github.com/prisma/prisma/issues/23410
38-
// TODO v8: Figure out a better solution for this, maybe only disable in ESM mode?
39-
// prismaIntegration(),
37+
prismaIntegration(),
4038
hapiIntegration(),
4139
koaIntegration(),
4240
connectIntegration(),

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
}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5860,10 +5860,10 @@
58605860
resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.28.tgz#d45e01c4a56f143ee69c54dd6b12eade9e270a73"
58615861
integrity sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==
58625862

5863-
"@prisma/instrumentation@6.6.0":
5864-
version "6.6.0"
5865-
resolved "https://registry.yarnpkg.com/@prisma/instrumentation/-/instrumentation-6.6.0.tgz#5b73164c722bcfcd29c43cb883b4735143b65eb2"
5866-
integrity sha512-M/a6njz3hbf2oucwdbjNKrSMLuyMCwgDrmTtkF1pm4Nm7CU45J/Hd6lauF2CDACTUYzu3ymcV7P0ZAhIoj6WRw==
5863+
"@prisma/instrumentation@6.7.0":
5864+
version "6.7.0"
5865+
resolved "https://registry.yarnpkg.com/@prisma/instrumentation/-/instrumentation-6.7.0.tgz#5fd97be1f89e9d9268148424a812deaea491f80a"
5866+
integrity sha512-3NuxWlbzYNevgPZbV0ktA2z6r0bfh0g22ONTxcK09a6+6MdIPjHsYx1Hnyu4yOq+j7LmupO5J69hhuOnuvj8oQ==
58675867
dependencies:
58685868
"@opentelemetry/instrumentation" "^0.52.0 || ^0.53.0 || ^0.54.0 || ^0.55.0 || ^0.56.0 || ^0.57.0"
58695869

0 commit comments

Comments
 (0)