Builder

Struct Builder 

Source
pub struct Builder { /* private fields */ }
Expand description

A builder for Spans.

Implementations§

Source§

impl Builder

Source

pub fn trace_id(&mut self, trace_id: TraceId) -> &mut Builder

Sets the trace ID of the span.

Source

pub fn name(&mut self, name: &str) -> &mut Builder

Sets the name of the span.

Defaults to None.

Source

pub fn parent_id(&mut self, parent_id: SpanId) -> &mut Builder

Sets the ID of the span’s parent.

Defaults to None.

Source

pub fn id(&mut self, id: SpanId) -> &mut Builder

Sets the ID of the span.

Source

pub fn kind(&mut self, kind: Kind) -> &mut Builder

Sets the kind of the span.

Defaults to None.

Source

pub fn timestamp(&mut self, timestamp: SystemTime) -> &mut Builder

Sets the time of the beginning of the span.

Defaults to None.

Source

pub fn duration(&mut self, duration: Duration) -> &mut Builder

Sets the duration of the span.

Defaults to None.

Source

pub fn debug(&mut self, debug: bool) -> &mut Builder

Sets the debug state of the span.

Defaults to false.

Source

pub fn shared(&mut self, shared: bool) -> &mut Builder

Sets the shared state of the span.

Defaults to false.

Source

pub fn local_endpoint(&mut self, local_endpoint: Endpoint) -> &mut Builder

Sets the local endpoint of the span.

Defaults to None.

Source

pub fn remote_endpoint(&mut self, remote_endpoint: Endpoint) -> &mut Builder

Sets the remote endpoint of the span.

Defaults to None.

Source

pub fn annotation(&mut self, annotation: Annotation) -> &mut Builder

Adds an annotation to the span.

Source

pub fn annotations<I>(&mut self, annotations: I) -> &mut Builder
where I: IntoIterator<Item = Annotation>,

Adds multiple annotations to the span.

Source

pub fn tag(&mut self, key: &str, value: &str) -> &mut Builder

Adds a tag to the span.

Source

pub fn tags<I>(&mut self, tags: I) -> &mut Builder
where I: IntoIterator<Item = (String, String)>,

As multiple tags to the span.

Source

pub fn build(&self) -> Span

Constructs a Span.

§Panics

Panics if trace_id or id was not set.

Trait Implementations§

Source§

impl From<Span> for Builder

Source§

fn from(s: Span) -> Builder

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.