Skip to content

Context propagation for query logging #7596

@tak1n

Description

@tak1n

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions