-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Context propagation for query logging #7596
Description
Problem
Currently query logs can not relate to requests or a parent context from which they were invoked from. This means solutions like https://github.com/iamolegga/nestjs-pino or as well datadog tracing DataDog/dd-trace-js#1244 are not able to work properly.
Suggested solution
Context propagation into query logging should work properly. Sadly I'm quite new to nodejs and therefore aren't able to further specify how this should happen. Also not sure if the architecture of prisma is a blocker here (separate query engine process, and whether this gets simpler once n-api is used)
Alternatives
I've looked at https://github.com/Jeff-Lewis/cls-hooked (which nestjs-pino uses under the hood) so not a real alternative, but tried to understand whats happening here.
Additional context
Slack convo: https://prisma.slack.com/archives/CA491RJH0/p1623345269439900