Skip to main content

Module telemetry

Module telemetry 

Source
Expand description

Structured logging: tracing initialisation (JSON for Kubernetes) and rate-limited hot-path logging helpers.

§Rate limiting on the hot path

A poison-message storm that logs per record will destroy the pinned pipeline threads. Hot-path warnings must go through a RateLimit, most conveniently via rate_limited_warn!:

use etl_core::rate_limited_warn;
use etl_core::telemetry::RateLimit;
use std::time::Duration;

static DESER_WARN: RateLimit = RateLimit::new(5, Duration::from_secs(10));

// In the record loop:
rate_limited_warn!(DESER_WARN, reason = "malformed", "payload skipped");

Structs§

RateLimit
A per-callsite token bucket: up to capacity events per window, then suppression with a count carried into the first event of the next window.

Enums§

Decision
Decision returned by RateLimit::check.
LogFormat
Output format for logs.

Functions§

init
Initialise the global tracing subscriber.