netring-exporters
Heavyweight anomaly exporters for netring, kept in a companion crate so the core stays free of their dependency trees (0.25 W5).
The anomaly exporters implement netring's AnomalySink, so they drop straight
into MonitorBuilder::sink(...); the metrics exporter rides an
on_capture_stats handler.
| Feature | Exporter | Transport |
|---|---|---|
otlp (default) |
OtlpAnomalySink |
OTLP/HTTP-JSON logs over a blocking HTTP client (ureq) |
otlp (default) |
OtlpMetricsExporter |
OTLP/HTTP-JSON metrics (capture counters) over ureq |
parquet |
ParquetFlowExporter |
columnar Parquet flow export (arrow + parquet) |
kafka |
KafkaSink |
Kafka producer (rdkafka → librdkafka, a C dependency) |
use Monitor;
use Tcp;
use OtlpAnomalySink;
let monitor = builder
.interface
.
.sink
.build?;
OtlpMetricsExporter pushes the per-source capture counters
(netring.capture.packets / .drops / .freezes cumulative Sums, plus the
windowed .drop_rate Gauge) to /v1/metrics once per sample period:
use Duration;
use OtlpMetricsExporter;
let exporter = new;
let monitor = builder
.interface
.
.on_capture_stats
.build?;
Examples
Runnable demos under examples/ (each prints what it would send, so
they run without a live collector/broker):
| Example | Feature | What it shows |
|---|---|---|
otlp_anomalies |
otlp |
OtlpAnomalySink → OTLP/HTTP-JSON logs to /v1/logs, dropped into .sink(..) |
otlp_metrics |
otlp |
OtlpMetricsExporter mapping CaptureTelemetry (packets/drops/freezes → Sums, drop_rate → Gauge) to /v1/metrics, driven from on_capture_stats |
parquet_flows |
parquet |
ParquetFlowExporter (impl netring::export::FlowExporter) writing flow records as ZSTD-compressed Parquet with a flat OTel/OCSF-named schema |
Why a separate crate?
rdkafka pulls librdkafka (a C library) and ureq pulls a TLS stack —
neither belongs in netring's zero-dependency-creep core. Pulling them only when
you actually export keeps cargo build -p netring lean.
Building
otlp(default): pure-Rust HTTP + TLS, builds anywhere.kafka: needs librdkafka.rdkafkabuilds a bundled copy via cmake by default; installcmake+ a C toolchain, or enablerdkafka/dynamic-linkingto link a system librdkafka.
Anomaly→wire-format conversion is unit-tested without a collector/broker; the live transport is validated against your OTLP collector / Kafka cluster.