Skip to content

Conversation

@sebws
Copy link
Contributor

@sebws sebws commented Jan 20, 2026

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).
  • Link an issue if there is one related to your pull request. If no issue is linked, one will be auto-generated and linked.

Closes #17181

@sebws sebws changed the title feat(node): pass through prisma instrumentation options feat(node): pass prisma instrumentation options through Jan 20, 2026
cursor[bot]

This comment was marked as outdated.

Copy link
Member

@JPeer264 JPeer264 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing thanks a lot for the contribution. I just added one tiny test.

Also for the record. I was thinking about omitting the enabled option, but that would need extra documentation why this is omitted - so its left as is :)

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

expect(PrismaInstrumentation).toHaveBeenCalledTimes(1);
expect(PrismaInstrumentation).toHaveBeenCalledWith(config);
});
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing integration or E2E tests for feature

Low Severity · Bugbot Rules

The PR adds a new instrumentationConfig option (a feat PR) but only includes unit tests with mocked dependencies. Per the review rules: "When reviewing a feat PR, check if the PR includes at least one integration or E2E test." The existing unit tests verify mock interactions but don't test that configuration actually passes through to a real PrismaInstrumentation instance and affects behavior correctly. Flagging because the rules file explicitly requires this.

Fix in Cursor Fix in Web

@JPeer264
Copy link
Member

Just as a quick FYI. The hydrogen tests are failing - we are on it to fix them. Once they pass I'll rebase and merge :)

@JPeer264 JPeer264 enabled auto-merge (squash) January 23, 2026 09:36
Comment on lines +172 to +173
export const instrumentPrisma = generateInstrumentOnce<PrismaOptions>(INTEGRATION_NAME, options => {
return new SentryPrismaInteropInstrumentation(options);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Re-initializing prismaIntegration with new options passes the wrong object shape to setConfig, causing the new configuration to be ignored or fail.
Severity: MEDIUM

Suggested Fix

Refactor instrumentPrisma to use the three-parameter form of generateInstrumentOnce, providing an optionsCallback function. This callback should extract the instrumentationConfig from the full PrismaOptions object, ensuring that both the constructor and setConfig receive an object with the same, correct shape. This pattern is used by the GraphQL integration.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: packages/node/src/integrations/tracing/prisma.ts#L172-L173

Potential issue: The `prismaIntegration` uses a version of `generateInstrumentOnce` that
causes a type mismatch during re-initialization. On the first call, the
`SentryPrismaInteropInstrumentation` constructor correctly receives the
`instrumentationConfig` object. However, on subsequent calls with new options, the
`instrumented.setConfig()` method is called with the entire `PrismaOptions` object, not
just the nested `instrumentationConfig`. This mismatch means any updated configuration
will be ignored or could lead to runtime errors if the application hot-reloads or
re-initializes Sentry with different Prisma settings.

Did we get this right? 👍 / 👎 to inform future reviews.

@JPeer264 JPeer264 merged commit 56f5098 into getsentry:develop Jan 23, 2026
129 checks passed
JPeer264 added a commit that referenced this pull request Jan 23, 2026
This PR adds the external contributor to the CHANGELOG.md file, so that
they are credited for their contribution. See #18900

Co-authored-by: JPeer264 <10677263+JPeer264@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose ignoreSpanTypes via prisma integration

2 participants