pub struct EventBuilder<S: State = Empty> { /* private fields */ }Expand description
Use builder syntax to set the inputs and finish with call().
Implementations§
Source§impl<S: State> EventBuilder<S>
impl<S: State> EventBuilder<S>
Sourcepub fn level(self, value: EventLevel) -> EventBuilder<SetLevel<S>>where
S::Level: IsUnset,
pub fn level(self, value: EventLevel) -> EventBuilder<SetLevel<S>>where
S::Level: IsUnset,
Sourcepub fn maybe_level(self, value: Option<EventLevel>) -> EventBuilder<SetLevel<S>>where
S::Level: IsUnset,
pub fn maybe_level(self, value: Option<EventLevel>) -> EventBuilder<SetLevel<S>>where
S::Level: IsUnset,
Sourcepub fn message(self, value: impl Into<String>) -> EventBuilder<SetMessage<S>>where
S::Message: IsUnset,
pub fn message(self, value: impl Into<String>) -> EventBuilder<SetMessage<S>>where
S::Message: IsUnset,
Sourcepub fn maybe_message(
self,
value: Option<impl Into<String>>,
) -> EventBuilder<SetMessage<S>>where
S::Message: IsUnset,
pub fn maybe_message(
self,
value: Option<impl Into<String>>,
) -> EventBuilder<SetMessage<S>>where
S::Message: IsUnset,
Sourcepub fn timestamp(self, value: SystemTime) -> EventBuilder<SetTimestamp<S>>where
S::Timestamp: IsUnset,
pub fn timestamp(self, value: SystemTime) -> EventBuilder<SetTimestamp<S>>where
S::Timestamp: IsUnset,
Sourcepub fn maybe_timestamp(
self,
value: Option<SystemTime>,
) -> EventBuilder<SetTimestamp<S>>where
S::Timestamp: IsUnset,
pub fn maybe_timestamp(
self,
value: Option<SystemTime>,
) -> EventBuilder<SetTimestamp<S>>where
S::Timestamp: IsUnset,
Source§impl<S: State> EventBuilder<S>
Custom methods for the event builder to support individual attribute calls
impl<S: State> EventBuilder<S>
Custom methods for the event builder to support individual attribute calls
Sourcepub fn attribute(self, key: impl Into<String>, value: impl Into<Value>) -> Self
pub fn attribute(self, key: impl Into<String>, value: impl Into<Value>) -> Self
Add a single attribute to the event.
This method accepts any value that can be converted to an OpenTelemetry Value,
including strings, numbers, booleans, and other supported types.
§Examples
use lambda_otel_lite::events::{event, EventLevel};
event()
.level(EventLevel::Info)
.message("User action")
.attribute("user_id", "123") // String
.attribute("count", 42) // Integer
.attribute("score", 98.5) // Float
.attribute("is_admin", true) // Boolean
.call();Sourcepub fn add_attributes(self, attrs: Vec<KeyValue>) -> Self
pub fn add_attributes(self, attrs: Vec<KeyValue>) -> Self
Add multiple attributes at once from a vector.
This is useful when you have a collection of attributes to add.
§Examples
use lambda_otel_lite::events::{event, EventLevel};
use opentelemetry::KeyValue;
event()
.level(EventLevel::Info)
.message("Batch operation")
.add_attributes(vec![
KeyValue::new("batch_id", "batch_123"),
KeyValue::new("item_count", 100),
])
.call();Auto Trait Implementations§
impl<S> Freeze for EventBuilder<S>
impl<S> RefUnwindSafe for EventBuilder<S>
impl<S> Send for EventBuilder<S>
impl<S> Sync for EventBuilder<S>
impl<S> Unpin for EventBuilder<S>
impl<S> UnwindSafe for EventBuilder<S>
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>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request