pub struct InMemoryObserver { /* private fields */ }Expand description
Test-grade observer: every envelope is delivered to an
InMemorySink. Spec 61 § 2.4 example.
Implementations§
Source§impl InMemoryObserver
impl InMemoryObserver
Sourcepub fn new() -> InMemoryObserver
pub fn new() -> InMemoryObserver
Construct with an empty schema registry. The registry is only
consulted by ScrubbedEnvelope::pass_through to populate
schema() — for in-memory tests we don’t need decoding so an
empty registry is fine.
Sourcepub fn with_sink(sink: InMemorySink) -> InMemoryObserver
pub fn with_sink(sink: InMemorySink) -> InMemoryObserver
Construct with an existing sink. Used when several observers should aggregate into the same buffer.
Sourcepub fn handle(&self) -> InMemoryHandle
pub fn handle(&self) -> InMemoryHandle
Stable handle to the buffer (drain / count / wait_for).
Trait Implementations§
Source§impl Clone for InMemoryObserver
impl Clone for InMemoryObserver
Source§fn clone(&self) -> InMemoryObserver
fn clone(&self) -> InMemoryObserver
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 InMemoryObserver
impl Debug for InMemoryObserver
Source§impl Default for InMemoryObserver
impl Default for InMemoryObserver
Source§fn default() -> InMemoryObserver
fn default() -> InMemoryObserver
Returns the “default value” for a type. Read more
Source§impl Observer for InMemoryObserver
impl Observer for InMemoryObserver
Source§fn emit_envelope(&self, env: ObsEnvelope)
fn emit_envelope(&self, env: ObsEnvelope)
Hot-path emit. Never blocks. Never panics. Spec 11 § 3.
Source§fn enabled(&self, _callsite: &ObsCallsite) -> bool
fn enabled(&self, _callsite: &ObsCallsite) -> bool
Cheap callsite filter check; called only when the cached
Interest is Sometimes. Default impl returns true
(allows every callsite that survived enabled_static).Source§fn generation(&self) -> u32
fn generation(&self) -> u32
Monotonic generation counter; bumped on every filter / config
change so callsite caches re-validate. Spec 11 § 3.2.
Source§fn reload_filter(&self)
fn reload_filter(&self)
Force every callsite’s
interest cache back to Unknown.
Default impl is a no-op for observers that don’t filter.Source§fn flush(&self) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
fn flush(&self) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
Flush all sinks; await in-flight batches. Default no-op.
Source§fn shutdown(&self) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
fn shutdown(&self) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
Shutdown all sinks and join workers. Idempotent.
Source§fn shutdown_blocking(&self, timeout: Duration)
fn shutdown_blocking(&self, timeout: Duration)
Synchronous shutdown for use in panic hooks and
Drop impls
where awaiting is not possible. Best-effort within timeout.
Spec 11 § 3, § 6.1.Source§fn callsites(&self) -> Option<Arc<ObsCallsiteRegistry>>
fn callsites(&self) -> Option<Arc<ObsCallsiteRegistry>>
Access this observer’s per-process callsite registry, when it
has one. The bridge (Direction A) writes the registry on first
sight;
ObsToTracingSink reads it to reconstitute
tracing::Metadata for interned envelopes. Spec 31 § 3.2.Source§fn schema_registry(&self) -> Option<Arc<SchemaRegistry>>
fn schema_registry(&self) -> Option<Arc<SchemaRegistry>>
Access this observer’s schema registry, when it has one. Sinks
hold their own
Arc<SchemaRegistry> from construction; this
hook lets the bridge fall back to the global observer’s
registry without depending on StandardObserver.Source§fn resource_attrs(&self) -> Arc<ResourceAttrs>
fn resource_attrs(&self) -> Arc<ResourceAttrs>
Snapshot of the workspace-shared
ResourceAttrs (OTel
semantic-convention keys). Sinks call this at flush time so a
single config-watcher reload re-projects every sink. Default
returns the empty / observer-less attribute set; concrete
observers (StandardObserver) override. Spec 20 § 2.1 / spec
94 § 2.7 / P1-E.Auto Trait Implementations§
impl Freeze for InMemoryObserver
impl !RefUnwindSafe for InMemoryObserver
impl Send for InMemoryObserver
impl Sync for InMemoryObserver
impl Unpin for InMemoryObserver
impl UnsafeUnpin for InMemoryObserver
impl !UnwindSafe for InMemoryObserver
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,
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> 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