pub struct OtelConfig {Show 46 fields
pub endpoint: String,
pub trace_endpoint: Option<String>,
pub metric_endpoint: Option<String>,
pub log_endpoint: Option<String>,
pub endpoint_headers: Option<String>,
pub trace_headers: Option<String>,
pub metric_headers: Option<String>,
pub log_headers: Option<String>,
pub endpoint_timeout_millis: Option<u64>,
pub trace_timeout_millis: Option<u64>,
pub metric_timeout_millis: Option<u64>,
pub log_timeout_millis: Option<u64>,
pub profiling_endpoint: Option<String>,
pub traces_export_enabled: Option<bool>,
pub metrics_export_enabled: Option<bool>,
pub logs_export_enabled: Option<bool>,
pub profiling_export_enabled: Option<bool>,
pub use_stdout: Option<bool>,
pub sample_ratio: Option<f64>,
pub meter_interval: Option<u64>,
pub service_name: Option<String>,
pub service_version: Option<String>,
pub environment: Option<String>,
pub logger_level: Option<String>,
pub log_stdout_enabled: Option<bool>,
pub log_directory: Option<String>,
pub log_filename: Option<String>,
pub log_rotation_time: Option<String>,
pub log_keep_files: Option<usize>,
pub log_max_total_size_bytes: Option<u64>,
pub log_max_single_file_size_bytes: Option<u64>,
pub log_compress_old_files: Option<bool>,
pub log_gzip_compression_level: Option<u32>,
pub log_compression_algorithm: Option<String>,
pub log_parallel_compress: Option<bool>,
pub log_parallel_workers: Option<usize>,
pub log_zstd_compression_level: Option<i32>,
pub log_zstd_fallback_to_gzip: Option<bool>,
pub log_zstd_workers: Option<usize>,
pub log_compressed_file_retention_days: Option<u64>,
pub log_exclude_patterns: Option<String>,
pub log_delete_empty_files: Option<bool>,
pub log_min_file_age_seconds: Option<u64>,
pub log_cleanup_interval_seconds: Option<u64>,
pub log_dry_run: Option<bool>,
pub log_match_mode: Option<String>,
}Expand description
Full observability configuration used by all telemetry backends.
Fields are grouped into three logical sections:
§OpenTelemetry / OTLP export
Controls whether and where traces, metrics, and logs are exported over the wire using the OTLP/HTTP protocol.
§Local logging
Controls the rolling-file appender: directory, filename, rotation policy, and the number of files to retain.
§Log cleanup
Controls the background cleanup task: size limits, compression, retention of compressed archives, exclusion patterns, and dry-run mode.
§Design Notes
- All fields are
Option<T>to allow partial configuration via environment variables with sensible defaults provided by constants inrustfs-config. log_keep_filesis used to derive the rolling-appender’s upper bound on retained files (if enabled) and to set the cleaner’s retained-file ceiling.
§Example
use rustfs_obs::OtelConfig;
// Build from environment variables (typical production usage).
let config = OtelConfig::new();
// Build with an explicit OTLP endpoint.
let config = OtelConfig::extract_otel_config_from_env(
Some("http://otel-collector:4318".to_string())
);
// Compression related env mapping examples:
// RUSTFS_OBS_LOG_COMPRESSION_ALGORITHM=zstd
// RUSTFS_OBS_LOG_PARALLEL_COMPRESS=true
// RUSTFS_OBS_LOG_PARALLEL_WORKERS=6Fields§
§endpoint: StringRoot OTLP/HTTP endpoint (e.g. http://otel-collector:4318).
Per-signal endpoints below take precedence when set.
trace_endpoint: Option<String>Dedicated trace endpoint; overrides endpoint + /v1/traces fallback.
metric_endpoint: Option<String>Dedicated metrics endpoint; overrides endpoint + /v1/metrics fallback.
log_endpoint: Option<String>Dedicated log endpoint; overrides endpoint + /v1/logs fallback.
endpoint_headers: Option<String>Headers applied to all OTLP signals when using HTTP exporter.
Format: comma-separated key=value pairs with URL-encoded values, for
example: Authorization=Bearer%20abc%20123,X-Scope-OrgID=my-tenant.
URL-encode reserved characters in values such as spaces, commas, and =.
trace_headers: Option<String>Additional headers for traces; merged on top of endpoint_headers.
Uses the same comma-separated key=value format with URL-encoded values.
metric_headers: Option<String>Additional headers for metrics; merged on top of endpoint_headers.
Uses the same comma-separated key=value format with URL-encoded values.
log_headers: Option<String>Additional headers for logs; merged on top of endpoint_headers.
Uses the same comma-separated key=value format with URL-encoded values.
endpoint_timeout_millis: Option<u64>Timeout (milliseconds) for all OTLP HTTP exports.
trace_timeout_millis: Option<u64>Timeout (milliseconds) for trace OTLP HTTP export.
metric_timeout_millis: Option<u64>Timeout (milliseconds) for metrics OTLP HTTP export.
log_timeout_millis: Option<u64>Timeout (milliseconds) for log OTLP HTTP export.
profiling_endpoint: Option<String>Dedicated profiling endpoint.
traces_export_enabled: Option<bool>Whether to export distributed traces (default: true).
metrics_export_enabled: Option<bool>Whether to export metrics (default: true).
logs_export_enabled: Option<bool>Whether to export logs via OTLP (default: true).
profiling_export_enabled: Option<bool>Whether to export profiles via pyroscope (default: true).
use_stdout: Option<bool>[OTLP-only] Mirror all signals to stdout in addition to OTLP export. Only applies when an OTLP endpoint is configured.
sample_ratio: Option<f64>Fraction of traces to sample, 0.0–1.0 (default: 1.0).
meter_interval: Option<u64>Metrics export interval in seconds (default: 30).
service_name: Option<String>OTel service.name attribute (default: APP_NAME).
service_version: Option<String>OTel service.version attribute (default: SERVICE_VERSION).
environment: Option<String>Deployment environment tag, e.g. production or development.
logger_level: Option<String>Minimum log level directive (default: error).
Respects RUST_LOG syntax when set via environment.
log_stdout_enabled: Option<bool>When true, a stdout JSON layer is always attached regardless of the
active backend (default: false in production, true otherwise).
log_directory: Option<String>Directory where rolling log files are written. When absent or empty, logging falls back to stdout-only mode.
log_filename: Option<String>Base name for log files (without date suffix), e.g. rustfs.
Used for both rolling-appender naming and cleanup scanning.
log_rotation_time: Option<String>Rotation time granularity: "minutely", "hourly", or "daily"
(default: "hourly"; any unrecognized value falls back to "daily").
log_keep_files: Option<usize>Number of rolling log files to retain (default: 30).
Used by both the rolling-appender (as a loose upper bound) and the
background cleaner (as the minimum retention count).
log_max_total_size_bytes: Option<u64>Hard ceiling on the total size (bytes) of all log files (default: 2 GiB).
log_max_single_file_size_bytes: Option<u64>Per-file size ceiling (bytes); 0 means unlimited (default: 0).
log_compress_old_files: Option<bool>Compress eligible files with gzip before deletion (default: true).
log_gzip_compression_level: Option<u32>Gzip compression level 1–9 (default: 6).
log_compression_algorithm: Option<String>Compression algorithm: gzip or zstd (default: zstd).
log_parallel_compress: Option<bool>Enable crossbeam work-stealing parallel compression (default: true).
log_parallel_workers: Option<usize>Worker count for parallel compression (default: 6).
log_zstd_compression_level: Option<i32>Zstd compression level 1–21 (default: 8).
log_zstd_fallback_to_gzip: Option<bool>Fallback to gzip when zstd compression fails (default: true).
log_zstd_workers: Option<usize>Internal zstdmt workers per job (default: 1).
log_compressed_file_retention_days: Option<u64>Delete compressed archives older than this many days; 0 = keep forever
(default: 30).
log_exclude_patterns: Option<String>Comma-separated glob patterns for files that must never be cleaned up.
log_delete_empty_files: Option<bool>Delete zero-byte log files during cleanup (default: true).
log_min_file_age_seconds: Option<u64>A file younger than this many seconds is never touched (default: 3600).
log_cleanup_interval_seconds: Option<u64>How often the background cleanup task runs, in seconds (default: 1800).
log_dry_run: Option<bool>Log what would be deleted without actually removing anything
(default: false).
log_match_mode: Option<String>File matching mode: “prefix” or “suffix” (default: “suffix”).
Implementations§
Source§impl OtelConfig
impl OtelConfig
Sourcepub fn extract_otel_config_from_env(endpoint: Option<String>) -> OtelConfig
pub fn extract_otel_config_from_env(endpoint: Option<String>) -> OtelConfig
Build an OtelConfig from environment variables.
The optional endpoint argument sets the root OTLP endpoint. If it is
None or an empty string the value is read from the
RUSTFS_OBS_ENDPOINT environment variable instead.
When no endpoint is configured at all, use_stdout is forced to true
so that logs are still visible during development.
§Example
use rustfs_obs::OtelConfig;
// Read everything from env vars.
let config = OtelConfig::extract_otel_config_from_env(None);
// Override the endpoint programmatically.
let config = OtelConfig::extract_otel_config_from_env(
Some("http://localhost:4318".to_string())
);Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new OtelConfig populated entirely from environment variables.
Equivalent to OtelConfig::extract_otel_config_from_env(None).
§Example
use rustfs_obs::OtelConfig;
let config = OtelConfig::new();Trait Implementations§
Source§impl Clone for OtelConfig
impl Clone for OtelConfig
Source§fn clone(&self) -> OtelConfig
fn clone(&self) -> OtelConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OtelConfig
impl Debug for OtelConfig
Source§impl Default for OtelConfig
impl Default for OtelConfig
Source§impl<'de> Deserialize<'de> for OtelConfig
impl<'de> Deserialize<'de> for OtelConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for OtelConfig
impl RefUnwindSafe for OtelConfig
impl Send for OtelConfig
impl Sync for OtelConfig
impl Unpin for OtelConfig
impl UnsafeUnpin for OtelConfig
impl UnwindSafe for OtelConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request