fix: use otel.status_message for OTLP Status.message on failed jobs (#8995)

tracing-opentelemetry only recognizes otel.status_code and
otel.status_message as fields that map to the OTLP Status proto.
The previously-used otel.status_description fell through to the
generic attribute recorder, leaving Status.message unset and
preventing OTLP consumers from filtering spans on error status.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hugocasa
2026-05-01 18:19:22 +02:00
committed by Ruben Fiszel
parent a2a9214d29
commit a320d18da9
2 changed files with 7 additions and 7 deletions
@@ -112,7 +112,7 @@ async fn process_jc(
script_hash = field::Empty,
otel.name = field::Empty,
otel.status_code = "ERROR",
otel.status_description = field::Empty,
otel.status_message = field::Empty,
success = %success,
error.message = field::Empty,
error.name = field::Empty,
@@ -167,11 +167,11 @@ async fn process_jc(
span.record("error.message", result_error.message.as_str());
span.record("error.name", result_error.name.as_str());
span.record(
"otel.status_description",
"otel.status_message",
crate::worker::truncate_description(&result_error.message).as_str(),
);
} else {
span.record("otel.status_description", "Job failed");
span.record("otel.status_message", "Job failed");
}
}
+4 -4
View File
@@ -1342,7 +1342,7 @@ pub fn create_span_with_name(
script_hash = field::Empty,
otel.name = field::Empty,
otel.status_code = field::Empty,
otel.status_description = field::Empty,
otel.status_message = field::Empty,
);
let rj = arc_job.flow_innermost_root_job.unwrap_or(arc_job.id);
@@ -1382,12 +1382,12 @@ pub fn create_span_with_name(
span
}
/// Max characters of an error message copied into the `otel.status_description`
/// Max characters of an error message copied into the `otel.status_message`
/// span attribute. Prevents a single verbose failure from blowing up the span
/// payload on OTLP exporters.
const STATUS_DESCRIPTION_MAX_LEN: usize = 512;
/// Record `otel.status_code` / `otel.status_description` on the current span
/// Record `otel.status_code` / `otel.status_message` on the current span
/// when a job fails. Called from inside the `.instrument(job_span)` future so
/// that `Span::current()` resolves to the `"job"` span created by
/// `create_span_with_name`.
@@ -1402,7 +1402,7 @@ pub(crate) fn record_job_span_status(result: &windmill_common::error::Result<boo
};
let span = tracing::Span::current();
span.record("otel.status_code", "ERROR");
span.record("otel.status_description", description.as_str());
span.record("otel.status_message", description.as_str());
}
/// Cap an error description at `STATUS_DESCRIPTION_MAX_LEN` bytes, appending