Struct opentelemetry::InstrumentationLibraryBuilder

source ·
pub struct InstrumentationLibraryBuilder { /* private fields */ }
Expand description

Configuration options for InstrumentationLibrary.

An instrumentation library is a library or crate providing instrumentation. It should be named to follow any naming conventions of the instrumented library (e.g. ‘middleware’ for a web framework).

Apart from the name, all other fields are optional.

See the instrumentation libraries spec for more information.

Implementations§

source§

impl InstrumentationLibraryBuilder

source

pub fn with_version(self, version: impl Into<Cow<'static, str>>) -> Self

Configure the version for the instrumentation library

§Examples
let library = opentelemetry::InstrumentationLibrary::builder("my-crate")
    .with_version("v0.1.0")
    .build();
source

pub fn with_schema_url(self, schema_url: impl Into<Cow<'static, str>>) -> Self

Configure the Schema URL for the instrumentation library

§Examples
let library = opentelemetry::InstrumentationLibrary::builder("my-crate")
    .with_schema_url("https://opentelemetry.io/schemas/1.17.0")
    .build();
source

pub fn with_attributes<I>(self, attributes: I) -> Self
where I: IntoIterator<Item = KeyValue>,

Configure the attributes for the instrumentation library

§Examples
use opentelemetry::KeyValue;

let library = opentelemetry::InstrumentationLibrary::builder("my-crate")
    .with_attributes([KeyValue::new("k", "v")])
    .build();
source

pub fn build(self) -> InstrumentationLibrary

Create a new InstrumentationLibrary from this configuration

Trait Implementations§

source§

impl Debug for InstrumentationLibraryBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Available on crate feature trace only.
Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Available on crate feature trace only.
Attaches the current Context to this type, returning a WithContext wrapper. Read more
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.