pub struct BatchSink {
tx: Sender<Value>,
name: String,
}Expand description
Handle to a spawned batching task. Cheap to clone; the background task flushes any remaining entries and exits when the last handle is dropped.
Fields§
§tx: Sender<Value>§name: StringImplementations§
Source§impl BatchSink
impl BatchSink
Sourcepub fn spawn(
name: &str,
cfg: BatchConfig,
flusher: Arc<dyn BatchFlusher>,
) -> Self
pub fn spawn( name: &str, cfg: BatchConfig, flusher: Arc<dyn BatchFlusher>, ) -> Self
Spawns the background flush task and returns the sink handle.
name identifies the sink (typically the logger node id) in warning
and error logs.
Sourcepub fn push(&self, entry: Value)
pub fn push(&self, entry: Value)
Non-blocking enqueue of one log entry.
Never blocks or awaits: when the channel is full (the background task
is not keeping up, e.g. a slow or retrying downstream) the entry is
dropped and a tracing::warn! is emitted. The rate of such drops
is the operator’s signal to raise max_pending_entries.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BatchSink
impl RefUnwindSafe for BatchSink
impl Send for BatchSink
impl Sync for BatchSink
impl Unpin for BatchSink
impl UnsafeUnpin for BatchSink
impl UnwindSafe for BatchSink
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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