Skip to content

Commit f5147d5

Browse files
committed
pass through prisma instrumentation options
1 parent 348b283 commit f5147d5

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

  • packages/node/src/integrations/tracing

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,15 @@ interface PrismaOptions {
5858
* @deprecated This is no longer used, v5 works out of the box.
5959
*/
6060
prismaInstrumentation?: Instrumentation;
61+
/**
62+
* Configuration passed through to the {@link PrismaInstrumentation} constructor.
63+
*/
64+
instrumentationConfig?: ConstructorParameters<typeof PrismaInstrumentation>[0];
6165
}
6266

6367
class SentryPrismaInteropInstrumentation extends PrismaInstrumentation {
64-
public constructor() {
65-
super();
68+
public constructor(options?: PrismaOptions) {
69+
super(options?.instrumentationConfig);
6670
}
6771

6872
public enable(): void {
@@ -165,8 +169,8 @@ function engineSpanKindToOTELSpanKind(engineSpanKind: V5EngineSpanKind): SpanKin
165169
}
166170
}
167171

168-
export const instrumentPrisma = generateInstrumentOnce<PrismaOptions>(INTEGRATION_NAME, _options => {
169-
return new SentryPrismaInteropInstrumentation();
172+
export const instrumentPrisma = generateInstrumentOnce<PrismaOptions>(INTEGRATION_NAME, options => {
173+
return new SentryPrismaInteropInstrumentation(options);
170174
});
171175

172176
/**
@@ -201,11 +205,11 @@ export const instrumentPrisma = generateInstrumentOnce<PrismaOptions>(INTEGRATIO
201205
* }
202206
* ```
203207
*/
204-
export const prismaIntegration = defineIntegration((_options?: PrismaOptions) => {
208+
export const prismaIntegration = defineIntegration((options?: PrismaOptions) => {
205209
return {
206210
name: INTEGRATION_NAME,
207211
setupOnce() {
208-
instrumentPrisma();
212+
instrumentPrisma(options);
209213
},
210214
setup(client) {
211215
// If no tracing helper exists, we skip any work here

0 commit comments

Comments
 (0)