Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion engine/packages/gasoline/src/builder/workflow/lupe.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use std::time::{Duration, Instant};

use anyhow::Result;
use opentelemetry::trace::TraceContextExt;
use serde::{Serialize, de::DeserializeOwned};
use tracing::Instrument;
use tracing_opentelemetry::OpenTelemetrySpanExt;

use crate::{
ctx::WorkflowCtx,
Expand Down Expand Up @@ -140,6 +142,16 @@ impl<'a, S: Serialize + DeserializeOwned> LoopBuilder<'a, S> {

let previous_iteration = iteration;

let parent_span_ctx = tracing::Span::current()
.context()
.span()
.span_context()
.clone();

let iteration_span =
tracing::info_span!(parent: None, "iteration", iteration=%previous_iteration);
iteration_span.add_link(parent_span_ctx);

// Async block for instrumentation purposes
let res = async {
let db2 = ctx.db().clone();
Expand Down Expand Up @@ -281,7 +293,7 @@ impl<'a, S: Serialize + DeserializeOwned> LoopBuilder<'a, S> {
}
}
}
.instrument(tracing::info_span!("iteration", iteration=%previous_iteration))
.instrument(iteration_span)
.await?;

// Validate no leftover events
Expand Down