add more labels to traces

This commit is contained in:
Ruben Fiszel
2025-05-22 12:07:21 +02:00
parent dee62e1518
commit d662e18f97
3 changed files with 9 additions and 4 deletions
+1
View File
@@ -980,6 +980,7 @@ pub async fn add_completed_job<T: Serialize + Send + Sync + ValidableJson>(
is_flow_step = queued_job.is_flow_step(),
language = ?queued_job.script_lang,
scheduled_for = ?queued_job.scheduled_for,
workspace_id = ?queued_job.workspace_id,
success,
"inserted completed job: {} (success: {success})",
queued_job.id
+7 -4
View File
@@ -134,7 +134,7 @@ pub async fn handle_child(
let (tx, rx) = broadcast::channel::<()>(3);
let mut rx2: broadcast::Receiver<()> = tx.subscribe();
let output = child_joined_output_stream(&mut child, job_id.clone());
let output = child_joined_output_stream(&mut child, job_id.clone(), w_id.to_string());
let job_id: Uuid = job_id.clone();
@@ -729,6 +729,7 @@ where
fn child_joined_output_stream(
child: &mut Child,
job_id: Uuid,
w_id: String,
) -> impl stream::FusedStream<Item = io::Result<String>> {
let stderr = child
.stderr
@@ -743,8 +744,8 @@ fn child_joined_output_stream(
let stdout = BufReader::new(stdout).lines();
let stderr = BufReader::new(stderr).lines();
stream::select(
lines_to_stream(stderr, true, job_id.clone()),
lines_to_stream(stdout, false, job_id),
lines_to_stream(stderr, true, job_id.clone(), w_id.clone(), path.clone()),
lines_to_stream(stdout, false, job_id, w_id, path),
)
}
@@ -752,11 +753,13 @@ pub fn lines_to_stream<R: tokio::io::AsyncBufRead + Unpin>(
mut lines: tokio::io::Lines<R>,
stderr: bool,
job_id: Uuid,
w_id: String,
path: String,
) -> impl futures::Stream<Item = io::Result<String>> {
stream::poll_fn(move |cx| {
std::pin::Pin::new(&mut lines)
.poll_next_line(cx)
.map(|result| process_streaming_log_lines(result, stderr, &job_id))
.map(|result| process_streaming_log_lines(result, stderr, &job_id, &w_id))
})
}
@@ -36,6 +36,7 @@ pub(crate) fn process_streaming_log_lines(
r: Result<Option<String>, io::Error>,
_stderr: bool,
_job_id: &Uuid,
_w_id: &str,
) -> Option<Result<String, io::Error>> {
r.transpose()
}