pub struct TelemetryConfig {
pub enable_otlp_tracing: bool,
pub tokio_console: bool,
pub json_log_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 sample_rate: f64,
pub trace_target: Option<Vec<String>>,
}
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
Fields§
§enable_otlp_tracing: bool
§tokio_console: bool
Enables Tokio Console debugging on port 6669
json_log_output: bool
Output JSON logs.
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: bool
Set a panic hook
crash_on_panic: bool
Crash on panic
prom_registry: Option<Registry>
Optional Prometheus registry - if present, all enabled span latencies are measured
sample_rate: f64
§trace_target: Option<Vec<String>>
Add directive to include trace logs with provided target
Implementations§
Source§impl TelemetryConfig
impl TelemetryConfig
pub fn new() -> Self
pub fn with_json(self) -> 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_sample_rate(self, rate: f64) -> Self
pub fn with_trace_target(self, target: &str) -> Self
pub fn with_env(self) -> Self
pub fn init(self) -> (TelemetryGuards, TracingHandle)
Trait Implementations§
Source§impl Clone for TelemetryConfig
impl Clone for TelemetryConfig
Source§fn clone(&self) -> TelemetryConfig
fn clone(&self) -> TelemetryConfig
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TelemetryConfig
impl Debug for TelemetryConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§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>
Wrap the input message
T
in a tonic::Request
Source§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>
Wrap the input message
T
in a tonic::Request