pub struct Observer { /* private fields */ }Expand description
Process-level structured logger and trace correlator.
Cloning this value is cheap. Emission uses try_send; output and JSON
serialization happen on the dedicated writer thread.
Implementations§
Source§impl Observer
impl Observer
Sourcepub fn start_external_call(
&self,
application: impl Into<ApplicationId>,
module: impl Into<ModuleId>,
service: impl Into<ServiceId>,
operation: impl Into<OperationId>,
inbound_trace_id: Option<&str>,
) -> (ActiveCall, InboundTrace)
pub fn start_external_call( &self, application: impl Into<ApplicationId>, module: impl Into<ModuleId>, service: impl Into<ServiceId>, operation: impl Into<OperationId>, inbound_trace_id: Option<&str>, ) -> (ActiveCall, InboundTrace)
Starts an external request, inheriting a valid trace id or creating one.
Sourcepub fn start_child_call(
&self,
parent: &CallContext,
kind: CallKind,
module: impl Into<ModuleId>,
service: impl Into<ServiceId>,
operation: impl Into<OperationId>,
) -> ActiveCall
pub fn start_child_call( &self, parent: &CallContext, kind: CallKind, module: impl Into<ModuleId>, service: impl Into<ServiceId>, operation: impl Into<OperationId>, ) -> ActiveCall
Starts a Service, DB or transaction child call on the parent’s trace.
Sourcepub fn record_domain_event(&self, context: &CallContext, event: DomainEvent)
pub fn record_domain_event(&self, context: &CallContext, event: DomainEvent)
Records an intentional domain event without accepting arbitrary objects.
Source§impl Observer
impl Observer
Sourcepub fn with_writer(
config: ObserverConfig,
writer: impl Write + Send + 'static,
) -> Result<Self, InitError>
pub fn with_writer( config: ObserverConfig, writer: impl Write + Send + 'static, ) -> Result<Self, InitError>
Creates an observer with a framework-owned writer.
Application startup should normally use init. This constructor is
useful for embedding and deterministic tests.
Sourcepub fn flush(&self) -> FlushFuture ⓘ
pub fn flush(&self) -> FlushFuture ⓘ
Flushes records accepted before the lifecycle coordinator reaches the writer. The returned future never blocks the async executor thread.
Sourcepub fn shutdown(&self) -> FlushFuture ⓘ
pub fn shutdown(&self) -> FlushFuture ⓘ
Stops admission, drains accepted records, flushes output and joins the writer without blocking the async executor thread.