Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(node): Add prismaInstrumentation option to Prisma integration as escape hatch for all Prisma versions #15127

Merged
merged 4 commits into from
Jan 22, 2025

Conversation

lforst
Copy link
Member

@lforst lforst commented Jan 22, 2025

Ref #14793

Adds a compatibility layer to the prismaIntegration via the prismaInstrumentation option that can be used to pass a prisma instrumentation instance of older Prisma versions.

@lforst lforst requested a review from chargome January 22, 2025 11:52
Copy link
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

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

Looks good!


// Make sure we use the query text as the span name, for ex. SELECT * FROM "User" WHERE "id" = $1
if (spanJSON.description === 'prisma:engine:db_query' && spanJSON.data['db.query.text']) {
span.updateName(spanJSON.data['db.query.text'] as string);
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it actually be more consistent if we were to leave this as prisma:engine:db_query or maybe make this opt-in?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that would clash with our contract with Sentry but I'll let @AbhiPrasad confirm.

Copy link
Member

Choose a reason for hiding this comment

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

this is done to make the queries module work, as the queries module expects the query as the span name in it's current state.

eventually this won't be required once we have proper OTEL support (with all the attributes), but given the timeline for that is not super clear, we have to do this for now.

@lforst lforst merged commit 6e4b593 into develop Jan 22, 2025
99 checks passed
@lforst lforst deleted the lforst-prisma-v5-support branch January 22, 2025 13:00
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.

3 participants