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

qe: add json serialization span in binary engine #4339

Merged
merged 7 commits into from
Apr 10, 2024
7 changes: 4 additions & 3 deletions query-engine/query-engine/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ async fn request_handler(cx: Arc<PrismaContext>, req: Request<Body>) -> Result<R
match serialized_body {
Ok(body) => {
let handler = RequestHandler::new(cx.executor(), cx.query_schema(), cx.engine_protocol());
let mut result = handler.handle(body, tx_id, traceparent).instrument(span).await;
let mut result = handler.handle(body, tx_id, traceparent).await;

if let telemetry::capturing::Capturer::Enabled(capturer) = &capture_config {
let telemetry = capturer.fetch_captures().await;
Expand All @@ -183,7 +183,8 @@ async fn request_handler(cx: Arc<PrismaContext>, req: Request<Body>) -> Result<R
}
}

let res = build_json_response(StatusCode::OK, &result);
let json_span = tracing::info_span!("prisma:engine:response_json_serialization", user_facing = true);
let res = json_span.in_scope(|| build_json_response(StatusCode::OK, &result));

Ok(res)
}
Expand All @@ -202,7 +203,7 @@ async fn request_handler(cx: Arc<PrismaContext>, req: Request<Body>) -> Result<R
}
};

work.await
work.instrument(span).await
}

/// Expose the GraphQL playground if enabled.
Expand Down