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(qe): Capture query logs and return with response #3112

Closed
wants to merge 7 commits into from

Conversation

garrensmith
Copy link
Contributor

@garrensmith garrensmith commented Aug 10, 2022

Tracked in https://github.com/prisma/client-planning/issues/158

The Query engine server can use a new capture tracer that can
capture the query logs for a Prisma Operation and return them
as part of the response.

For the logs to be captured, start up the query engine with the flag --enable-logs-in-response.
For each query pass in a traceparent in the traceparent header. The trace-id is used to keep track of the relevant logs.
For each request you want a log response back add the header: CAPTURE_LOGS: true.

The response will then look like this:

{
  "result": result,
  "logs": logs
};

@garrensmith garrensmith added this to the 4.3.0 milestone Aug 10, 2022
@danstarns

This comment was marked as outdated.

@danstarns
Copy link
Contributor

When tracing is disabled, we set the trace parent to 00-10-10-00. https://github.com/prisma/prisma/blob/main/packages/engine-core/src/tracing/getTraceParent.ts#L25

I don't know if using the transparent for grouping the logs is the best course of action, as 9 times out of 10 the transparent is going to be a static value.

@garrensmith garrensmith force-pushed the log-capture branch 2 times, most recently from 67a1efc to 8c0827b Compare October 6, 2022 14:18
@janpio janpio modified the milestones: 4.3.0, 4.8.0 Nov 29, 2022
@danstarns
Copy link
Contributor

Client PR: prisma/prisma#16748

@miguelff miguelff self-assigned this Dec 13, 2022
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.

5 participants