Expand description
OpenTelemetry (OTLP) network exporter for rlg.
rlg renders records in LogFormat::OTLP shape and writes them to
the configured PlatformSink (stdout, file, os_log,
journald). This crate adds an HTTP exporter that POSTs
OTLP-shaped records to an OpenTelemetry Collector.
Wire format: OTLP/HTTP JSON encoding (Content-Type: application/json), over plain http://.
§Deployment: a local collector owns TLS
The exporter carries no TLS stack. It sends to a Collector (or
any OTLP/HTTP forwarder) on the same host or pod, by default
DEFAULT_ENDPOINT, and the Collector holds the TLS connection
and credentials for the backend. https:// endpoints are refused.
The README has a minimal Collector configuration.
§Example
use rlg_otlp::OtlpExporter;
use rlg::log::Log;
use rlg::log_format::LogFormat;
// Defaults to the Collector at http://localhost:4318/v1/logs.
let exporter = OtlpExporter::builder().timeout_secs(10).build();
let record = Log::error("payment-service down")
.component("orders")
.with("trace_id", "abc")
.format(LogFormat::OTLP);
// Synchronous push. Async push is on the roadmap.
exporter.export_one(&record).unwrap();Re-exports§
pub use crate::backoff::CircuitBreaker;pub use crate::backoff::RetryPolicy;pub use crate::async_http::AsyncOtlpExporter;asyncpub use crate::async_http::AsyncOtlpExporterBuilder;async
Modules§
- async_
http async - Async HTTP/JSON transport over Tokio and plain
http://. Enable with theasyncfeature. Async HTTP transport for OTLP/JSON over plainhttp://. - backoff
- Retry policy + full-jitter + tokens-per-window circuit breaker.
Structs§
- Otlp
Exporter - Synchronous HTTP/JSON exporter to an OTLP-compatible collector.
- Otlp
Exporter Builder - Fluent builder for
OtlpExporter.
Enums§
- Otlp
Error - Errors raised by
OtlpExporter.
Constants§
- DEFAULT_
ENDPOINT - The endpoint a builder uses when given none: the OTLP/HTTP logs route of a Collector on the same host.
Functions§
- serialise_
batch - Serialise a batch of records into a single OTLP/HTTP JSON envelope.
Type Aliases§
- Otlp
Result - A
Resultalias withOtlpErroras the error variant.