mirror of
https://github.com/actix/actix-extras.git
synced 2025-02-23 19:03:03 +01:00
Add error details.
This commit is contained in:
parent
f6586edb85
commit
e110e6cf8d
@ -24,6 +24,8 @@ pub trait RootSpanBuilder {
|
|||||||
/// - Request path (`http.target`);
|
/// - Request path (`http.target`);
|
||||||
/// - Status code (`http.status_code`);
|
/// - Status code (`http.status_code`);
|
||||||
/// - [Request id](crate::RequestId) (`request_id`);
|
/// - [Request id](crate::RequestId) (`request_id`);
|
||||||
|
/// - `Display` (`exception.message`) and `Debug` (`exception.details`) representations of the error, if there was an error;
|
||||||
|
/// - [Request id](crate::RequestId) (`request_id`);
|
||||||
/// - [OpenTelemetry trace identifier](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/overview.md#spancontext) (`trace_id`). Empty if the feature is not enabled;
|
/// - [OpenTelemetry trace identifier](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/overview.md#spancontext) (`trace_id`). Empty if the feature is not enabled;
|
||||||
/// - OpenTelemetry span kind, set to `server` (`otel.kind`).
|
/// - OpenTelemetry span kind, set to `server` (`otel.kind`).
|
||||||
///
|
///
|
||||||
@ -45,6 +47,11 @@ impl RootSpanBuilder for DefaultRootSpanBuilder {
|
|||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
let response_error = error.as_response_error();
|
let response_error = error.as_response_error();
|
||||||
|
span.record(
|
||||||
|
"exception.message",
|
||||||
|
&tracing::field::display(response_error),
|
||||||
|
);
|
||||||
|
span.record("exception.details", &tracing::field::debug(response_error));
|
||||||
let status_code = response_error.status_code();
|
let status_code = response_error.status_code();
|
||||||
span.record("http.status_code", &status_code.as_u16());
|
span.record("http.status_code", &status_code.as_u16());
|
||||||
|
|
||||||
|
@ -90,6 +90,9 @@ macro_rules! root_span {
|
|||||||
otel.status_code = $crate::root_span_macro::private::tracing::field::Empty,
|
otel.status_code = $crate::root_span_macro::private::tracing::field::Empty,
|
||||||
trace_id = $crate::root_span_macro::private::tracing::field::Empty,
|
trace_id = $crate::root_span_macro::private::tracing::field::Empty,
|
||||||
request_id = %request_id,
|
request_id = %request_id,
|
||||||
|
exception.message = $crate::root_span_macro::private::tracing::field::Empty,
|
||||||
|
// Not proper OpenTelemetry, but their terminology is fairly exception-centric
|
||||||
|
exception.details = $crate::root_span_macro::private::tracing::field::Empty,
|
||||||
$($field)*
|
$($field)*
|
||||||
);
|
);
|
||||||
std::mem::drop(connection_info);
|
std::mem::drop(connection_info);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user