Enum opentelemetry::trace::Status
source · pub enum Status {
Unset,
Error {
description: Cow<'static, str>,
},
Ok,
}
Expand description
The status of a Span
.
These values form a total order: Ok > Error > Unset. This means that setting
Status::Ok
will override any prior or future attempts to set a status with
Status::Error
or Status::Unset
.
The status should remain unset, except for the following circumstances:
Generally, instrumentation libraries should not set the code to
Status::Ok
, unless explicitly configured to do so. Instrumentation
libraries should leave the status code as unset unless there is an error.
Application developers and operators may set the status code to
Status::Ok
.
When span status is set to Status::Ok
it should be considered final and
any further attempts to change it should be ignored.
Analysis tools should respond to a Status::Ok
status by suppressing any
errors they would otherwise generate. For example, to suppress noisy errors
such as 404s.
Only the value of the last call will be recorded, and implementations are free to ignore previous calls.
Variants§
Unset
The default status.
Error
The operation contains an error.
Ok
The operation has been validated by an application developer or operator to have completed successfully.
Implementations§
source§impl Status
impl Status
sourcepub fn error(description: impl Into<Cow<'static, str>>) -> Self
pub fn error(description: impl Into<Cow<'static, str>>) -> Self
Create a new error status with a given description.
§Examples
use opentelemetry::trace::Status;
// record error with `str` description
let error_status = Status::error("something went wrong");
// or with `String` description
let error_status = Status::error(format!("too many foos: {}", 42));
Trait Implementations§
source§impl PartialEq for Status
impl PartialEq for Status
source§impl PartialOrd for Status
impl PartialOrd for Status
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Status
impl StructuralPartialEq for Status
Auto Trait Implementations§
impl Freeze for Status
impl RefUnwindSafe for Status
impl Send for Status
impl Sync for Status
impl Unpin for Status
impl UnwindSafe for Status
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)