pub struct BatchOptions {
pub max_queue_size: usize,
pub max_batch_size: usize,
pub max_batch_bytes: usize,
pub flush_interval: Duration,
pub export_timeout: Duration,
pub drop_policy: DropPolicy,
pub gzip: bool,
pub max_export_retries: u32,
pub retry_backoff: Duration,
pub on_drop: Option<DropCallback>,
pub on_error: Option<ErrorCallback>,
}Expand description
Batch processor options (SPEC §4 BatchOptions).
Fields§
§max_queue_size: usizeMaximum queued records (default 2048).
max_batch_size: usizeMaximum records per export (default 512).
max_batch_bytes: usizeMaximum UTF-8 JSON bytes per export (default 1 MiB). A single larger record is sent alone.
flush_interval: DurationExport at least this often (default 1 s).
export_timeout: DurationDeadline per export attempt (default 30 s); also the Block wait limit.
drop_policy: DropPolicyQueue-full behaviour (default DropPolicy::DropNewest).
gzip: boolAsk the exporter to gzip payloads (default true).
max_export_retries: u32Extra attempts for a batch whose export failed with a retryable error (default 2).
retry_backoff: DurationWait before retry n (1-based) is retry_backoff * 2^(n-1) (default 200 ms).
on_drop: Option<DropCallback>Called with records that were dropped.
on_error: Option<ErrorCallback>Called when an export fails or partially fails.
Implementations§
Source§impl BatchOptions
impl BatchOptions
Sourcepub fn max_queue_size(self, n: usize) -> Self
pub fn max_queue_size(self, n: usize) -> Self
Sets max_queue_size.
Sourcepub fn max_batch_size(self, n: usize) -> Self
pub fn max_batch_size(self, n: usize) -> Self
Sets max_batch_size.
Sourcepub fn max_batch_bytes(self, n: usize) -> Self
pub fn max_batch_bytes(self, n: usize) -> Self
Sets max_batch_bytes.
Sourcepub fn flush_interval(self, d: Duration) -> Self
pub fn flush_interval(self, d: Duration) -> Self
Sets flush_interval.
Sourcepub fn export_timeout(self, d: Duration) -> Self
pub fn export_timeout(self, d: Duration) -> Self
Sets export_timeout.
Sourcepub fn drop_policy(self, p: DropPolicy) -> Self
pub fn drop_policy(self, p: DropPolicy) -> Self
Sets drop_policy.
Sourcepub fn max_export_retries(self, n: u32) -> Self
pub fn max_export_retries(self, n: u32) -> Self
Sets max_export_retries.
Sourcepub fn retry_backoff(self, d: Duration) -> Self
pub fn retry_backoff(self, d: Duration) -> Self
Sets retry_backoff.
Sourcepub fn on_drop(
self,
f: impl Fn(&[LogRecord], DropReason) + Send + Sync + 'static,
) -> Self
pub fn on_drop( self, f: impl Fn(&[LogRecord], DropReason) + Send + Sync + 'static, ) -> Self
Sets the drop callback.
Trait Implementations§
Source§impl Clone for BatchOptions
impl Clone for BatchOptions
Source§impl Debug for BatchOptions
impl Debug for BatchOptions
Auto Trait Implementations§
impl !RefUnwindSafe for BatchOptions
impl !UnwindSafe for BatchOptions
impl Forget for BatchOptions
impl Freeze for BatchOptions
impl Move for BatchOptions
impl Send for BatchOptions
impl Sync for BatchOptions
impl Unpin for BatchOptions
impl UnsafeUnpin for BatchOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
T in a tonic::Request