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
impl InstrumentationLibraryBuilder
sourcepub fn with_version(self, version: impl Into<Cow<'static, str>>) -> Self
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();
sourcepub fn with_schema_url(self, schema_url: impl Into<Cow<'static, str>>) -> Self
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();
sourcepub fn with_attributes<I>(self, attributes: I) -> Selfwhere
I: IntoIterator<Item = KeyValue>,
pub fn with_attributes<I>(self, attributes: I) -> Selfwhere
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();
sourcepub fn build(self) -> InstrumentationLibrary
pub fn build(self) -> InstrumentationLibrary
Create a new InstrumentationLibrary from this configuration
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InstrumentationLibraryBuilder
impl RefUnwindSafe for InstrumentationLibraryBuilder
impl Send for InstrumentationLibraryBuilder
impl Sync for InstrumentationLibraryBuilder
impl Unpin for InstrumentationLibraryBuilder
impl UnwindSafe for InstrumentationLibraryBuilder
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
Mutably borrows from an owned value. Read more
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Available on crate feature
trace
only.source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Available on crate feature
trace
only.