pub struct BetterStackLogExporter { /* private fields */ }Expand description
LogExporter for Better Stack’s HTTP ingest API: maps records to events
(to_better_stack_event), splits batches so no request
exceeds 10 MiB, encodes them as JSON, NDJSON or MessagePack, gzips when asked and posts with
Authorization: Bearer <source token>. Exports are retried like idempotent calls (429, 5xx,
network errors); Better Stack does not deduplicate, so an ambiguous failure may store a
record twice.
Implementations§
Source§impl BetterStackLogExporter
impl BetterStackLogExporter
Sourcepub fn max_request_bytes(&self) -> usize
pub fn max_request_bytes(&self) -> usize
Uncompressed size limit of one request.
Sourcepub fn max_record_bytes(&self) -> usize
pub fn max_record_bytes(&self) -> usize
Encoded size limit of one record.
Sourcepub async fn send_events(
&self,
events: &[Value],
opts: SendEventsOptions,
) -> Result<()>
pub async fn send_events( &self, events: &[Value], opts: SendEventsOptions, ) -> Result<()>
Posts raw events (JSON objects; dt may be an RFC 3339 string or UNIX seconds/ms/ns) as
one request, without splitting. Errors: 403 → AUTHENTICATION, 402 → RATE_LIMITED (not
retryable), 406/413 → VALIDATION; a body over the request limit is a VALIDATION
error before anything is sent.
Trait Implementations§
Source§impl Clone for BetterStackLogExporter
impl Clone for BetterStackLogExporter
Source§impl Debug for BetterStackLogExporter
impl Debug for BetterStackLogExporter
Source§impl LogExporter for BetterStackLogExporter
impl LogExporter for BetterStackLogExporter
Source§fn export<'life0, 'life1, 'async_trait>(
&'life0 self,
records: &'life1 [LogRecord],
opts: ExportOptions,
) -> Pin<Box<dyn Future<Output = Result<ExportResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn export<'life0, 'life1, 'async_trait>(
&'life0 self,
records: &'life1 [LogRecord],
opts: ExportOptions,
) -> Pin<Box<dyn Future<Output = Result<ExportResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Encodes and posts records. Records over the record limit are rejected with a
VALIDATION error before anything is sent; a failed request fails its records and the
rest of the batch. Returns Err when nothing was accepted.