Add Prisma Tags to our Sql Commenter tracing for extra information
See original GitHub issueProblem
At the moment Prisma can add a trace id as a SQL comment when a trace id is passed to the query.
- See this PR as an example https://github.com/prisma/prisma-engines/pull/2587
- The comment example https://github.com/prisma/quaint/pull/329/files#diff-4b2e8a5b67b97212d61df2fd30b5c5205e9368947f0262bde6c17bcf99b7c931R713
The comment doesn’t give any more information around the query for example it doesn’t mention this query is from Prisma and what operation it was for.
Suggested solution
Allow the ability to add in extra Sql Tags. For example:
SELECT * FROM FOO /* operation='CreateUser', ORM='Prisma',
traceparent='00-5bd66ef5095369c7b0d1f8f4bd33716a-c532cb4098ac3dd2-01',
tracestate='congo%3Dt61rcWkgMzE%2Crojo%3D00f067aa0ba902b7'*/
We could make it that we always add in those SQL comments even if the trace id is not added. So the Query would look like:
SELECT * FROM FOO /* operation='CreateUser', ORM='Prisma'*/
We could do this by default or allow the user to opt into adding them.
Alternatives
Additional context
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Middleware (Reference) - Prisma
Prisma Client middleware allows you to perform actions before or after any query on any model with the prisma.$use method.
Read more >OpenTelemetry tracing (Preview) - Prisma
Tracing provides a detailed log of the activity that Prisma Client carries out, at an operation level, including the time taken to execute...
Read more >Raw database access (Reference) - Prisma
Prisma Client supports the option of sending raw queries to your database. You may wish to use raw queries if: you want to...
Read more >Enable query tagging with Sqlcommenter to understand ...
Query tagging augments your SQL statements with information about your application; you could tag queries by business logic, microservice, route ...
Read more >Get Posts With selected tags using Prisma - Stack Overflow
Notice how the only difference between your query and this one is the use of the some property. To learn more about it,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m away this week but I can try and find an easier ticket to work on next week.
From: Bogdan Soare @.> Sent: Wednesday, May 18, 2022 8:12:44 PM To: prisma/prisma @.> Cc: garren smith @.>; Mention @.> Subject: Re: [prisma/prisma] Add Prisma Tags to our Sql Commenter tracing for extra information (Issue #13360)
Got it, thank you for letting me know.
Once things are more clear if you need any help please let me know.
— Reply to this email directly, view it on GitHubhttps://github.com/prisma/prisma/issues/13360#issuecomment-1130346388, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AABL2ARKY234VXSGKT3C6RLVKUXJZANCNFSM5V3LHVSA. You are receiving this because you were mentioned.Message ID: @.***>
This looks great! I appreciate the links you provided to get more context too.
Two questions/thoughts: