Struct ResourceBuilder
pub struct ResourceBuilder { /* private fields */ }Expand description
Builder for Resource
Implementations§
§impl ResourceBuilder
impl ResourceBuilder
pub fn with_detector(
self,
detector: Box<dyn ResourceDetector>,
) -> ResourceBuilder
pub fn with_detector( self, detector: Box<dyn ResourceDetector>, ) -> ResourceBuilder
Add a single ResourceDetector to your resource.
pub fn with_detectors(
self,
detectors: &[Box<dyn ResourceDetector>],
) -> ResourceBuilder
pub fn with_detectors( self, detectors: &[Box<dyn ResourceDetector>], ) -> ResourceBuilder
Add multiple ResourceDetectors to your resource.
pub fn with_attribute(self, kv: KeyValue) -> ResourceBuilder
pub fn with_attribute(self, kv: KeyValue) -> ResourceBuilder
Add a KeyValue to the resource.
pub fn with_attributes<T>(self, kvs: T) -> ResourceBuilderwhere
T: IntoIterator<Item = KeyValue>,
pub fn with_attributes<T>(self, kvs: T) -> ResourceBuilderwhere
T: IntoIterator<Item = KeyValue>,
Add multiple KeyValues to the resource.
pub fn with_service_name(self, name: impl Into<Value>) -> ResourceBuilder
pub fn with_service_name(self, name: impl Into<Value>) -> ResourceBuilder
Add service.name resource attribute.
pub fn with_schema_url<KV, S>(
self,
attributes: KV,
schema_url: S,
) -> ResourceBuilder
pub fn with_schema_url<KV, S>( self, attributes: KV, schema_url: S, ) -> ResourceBuilder
This will merge the provided schema_url with the current state of the Resource being built. It
will use the following rules to determine which schema_url should be used.
§Schema url
Schema url is determined by the following rules, in order:
- If the current builder resource doesn’t have a
schema_url, the providedschema_urlwill be used. - If the current builder resource has a
schema_url, and the providedschema_urlis different from the builder resource,schema_urlwill be empty. - If the provided
schema_urlis the same as the current builder resource, it will be used.
pub fn build(self) -> Resource
pub fn build(self) -> Resource
Create a Resource with the options provided to the ResourceBuilder.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ResourceBuilder
impl RefUnwindSafe for ResourceBuilder
impl Send for ResourceBuilder
impl Sync for ResourceBuilder
impl Unpin for ResourceBuilder
impl UnwindSafe for ResourceBuilder
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Create a new
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more