logo
pub enum Status {
    Unset,
    Error {
        description: Cow<'static, str>,
    },
    Ok,
}
Available on crate feature trace only.
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

Fields

description: Cow<'static, str>

The description of the error

The operation contains an error.

Ok

The operation has been validated by an application developer or operator to have completed successfully.

Implementations

Create a new error status with a given description.

Examples
use opentelemetry_api::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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Attaches the provided Context to this type, returning a WithContext wrapper. Read more

Attaches the current Context to this type, returning a WithContext wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.