Struct telemetry_subscribers::TelemetryConfig
source · pub struct TelemetryConfig {Show 13 fields
pub service_name: String,
pub enable_jaeger: bool,
pub tokio_console: bool,
pub json_log_output: bool,
pub span_log_output: bool,
pub chrome_trace_output: bool,
pub log_file: Option<String>,
pub log_string: Option<String>,
pub span_level: Option<Level>,
pub panic_hook: bool,
pub crash_on_panic: bool,
pub prom_registry: Option<Registry>,
pub custom_layers: Vec<Box<dyn Layer<Registry> + Send + Sync + 'static>>,
}Expand description
§Configuration for different logging/tracing options
- json_log_output: Output JSON logs to stdout only.
- log_file: If defined, write output to a file starting with this name, ex app.log
- log_level: error/warn/info/debug/trace, defaults to info
- service_name:
Fields§
§service_name: StringThe name of the service for Jaeger and Bunyan
enable_jaeger: bool§tokio_console: boolEnables Tokio Console debugging on port 6669
json_log_output: boolOutput JSON logs.
span_log_output: boolOutput span start/close to regular logs, controlled using regular RUST_LOG levels
chrome_trace_output: boolWrite chrome trace output, which can be loaded from chrome://tracing
log_file: Option<String>If defined, write output to a file starting with this name, ex app.log
log_string: Option<String>Log level to set, defaults to info
span_level: Option<Level>Span level - what level of spans should be created. Note this is not same as logging level If set to None, then defaults to INFO
panic_hook: boolSet a panic hook
crash_on_panic: boolCrash on panic
prom_registry: Option<Registry>Optional Prometheus registry - if present, all enabled span latencies are measured
custom_layers: Vec<Box<dyn Layer<Registry> + Send + Sync + 'static>>Pass in any additional custom layers that the consumer wants their subscriber to be created with
Implementations§
source§impl TelemetryConfig
impl TelemetryConfig
pub fn new(service_name: &str) -> Self
pub fn with_log_level(self, log_string: &str) -> Self
pub fn with_span_level(self, span_level: Level) -> Self
pub fn with_log_file(self, filename: &str) -> Self
pub fn with_prom_registry(self, registry: &Registry) -> Self
pub fn with_layer<L>(self, layer: L) -> Self
pub fn with_env(self) -> Self
pub fn init(self) -> (TelemetryGuards, FilterHandle)
Trait Implementations§
source§impl Default for TelemetryConfig
impl Default for TelemetryConfig
source§fn default() -> TelemetryConfig
fn default() -> TelemetryConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TelemetryConfig
impl !RefUnwindSafe for TelemetryConfig
impl Send for TelemetryConfig
impl Sync for TelemetryConfig
impl Unpin for TelemetryConfig
impl !UnwindSafe for TelemetryConfig
Blanket Implementations§
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
Mutably borrows from an owned value. Read more