Skip to main content

Crate ratatouille

Crate ratatouille 

Source
Expand description

Best-effort telemetry firehose logging with bounded topic state.

The crate keeps the hot path intentionally small: a logger filters topics, assigns per-topic sequence counters, formats either text or NDJSON lines, and forwards them to a sink.

By default, no topics are enabled. Configure LoggerConfig::filter to enable emission.

use ratatouille::{Format, Logger, LoggerConfig, SourceIdentity};

let mut config = LoggerConfig::default();
config.filter = Some("api*,-api:noise".into());
config.format = Format::Ndjson;
config.source = SourceIdentity {
    app: Some("example".into()),
    r#where: Some("rust".into()),
    instance: Some("local".into()),
};

let mut logger = Logger::new(config);
assert_eq!(logger.log("api", "hello"), ratatouille::EmitResult::Emitted);
assert_eq!(logger.log("api:noise", "drop me"), ratatouille::EmitResult::Filtered);

Structs§

FnSink
Sink adapter for an arbitrary callback.
HttpRelay
Bounded in-memory HTTP relay with explicit flushing.
HttpRelayConfig
Configuration for the bounded HTTP relay.
HttpRelayStats
Counters for the bounded HTTP relay.
HttpSink
Plain HTTP sink that posts NDJSON chunks to a single endpoint.
HttpSinkConfig
Configuration for the plain HTTP sink.
HttpSinkStats
Counters for the plain HTTP sink.
Logger
Topic logger with per-topic sequence counters.
LoggerConfig
Logger configuration.
SourceIdentity
Optional source identity included in NDJSON output.
Stats
Per-logger counters.
StdoutSink
Sink that writes each line to stdout.
TcpRelay
Bounded in-memory TCP relay with explicit flushing.
TcpRelayConfig
Configuration for the bounded TCP relay.
TcpRelayStats
Counters for the bounded TCP relay.
TcpSink
Plain TCP sink that sends newline-terminated chunks to one endpoint.
TcpSinkConfig
Configuration for the plain TCP sink.
TcpSinkStats
Counters for the plain TCP sink.

Enums§

DropPolicy
Queue overflow behavior for relay sinks.
EmitResult
Outcome of one log attempt.
Format
Output line format for emitted records.

Traits§

Sink
Sink interface for receiving already-formatted lines.