Skip to content

Commit

Permalink
qe: always create a span for prisma:engine regardless of iTX
Browse files Browse the repository at this point in the history
Prevent `prisma:engine:response_json_serialization` span from being
orphan when using interactive transactions.

This check made sense in the past in principle when there were no child
spans outside of the iTX runner, and the `prisma:engine` span didn't
cover the whole `Engine::query` method duration, but now it makes more
sense to always create it.

Fixes: prisma/prisma#21402
  • Loading branch information
aqrln committed Jan 12, 2024
1 parent e245ca0 commit f39df25
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions query-engine/query-engine-node-api/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use serde::Deserialize;
use serde_json::json;
use std::{collections::HashMap, future::Future, marker::PhantomData, panic::AssertUnwindSafe, sync::Arc};
use tokio::sync::RwLock;
use tracing::{field, instrument::WithSubscriber, Instrument, Span};
use tracing::{field, instrument::WithSubscriber, Instrument};
use tracing_subscriber::filter::LevelFilter;
use user_facing_errors::Error;

Expand Down Expand Up @@ -314,12 +314,7 @@ impl QueryEngine {

let query = RequestBody::try_from_str(&body, engine.engine_protocol())?;

let span = if tx_id.is_none() {
tracing::info_span!("prisma:engine", user_facing = true)
} else {
Span::none()
};

let span = tracing::info_span!("prisma:engine", user_facing = true);
let trace_id = telemetry::helpers::set_parent_context_from_json_str(&span, &trace);

async move {
Expand Down

0 comments on commit f39df25

Please sign in to comment.