Struct Diagnostics
Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker.
Independent diagnostics context with immutable startup enablement.
Clones share this context only. State and budgets are independent of logger lifetime and of any other explicitly isolated embedded contexts.
Implementations
impl Diagnostics
impl Diagnostics
from_settings
pub fn from_settings(
source: SourceIdentity,
settings: DiagnosticsSettings,
) -> Result<Self, DiagnosticError>
Construct a context using the startup owner’s selected mode and capacities.
Enabled mode validates arithmetic and admits backend storage before use. The circular-history allocation uses the global allocation-error handler on allocation failure; fallible pool reservations return an error. Disabled mode retains lightweight source/settings state without registry, history, detail, query, or projection pools. Source role/version metadata is capped at 128 UTF-8 bytes; the supplied UUID is preserved.
install_process_default
pub fn install_process_default(
source: SourceIdentity,
settings: DiagnosticsSettings,
) -> Result<&'static Self, DiagnosticError>
Install before handing out default handles. Once used, inert handles are never silently upgraded to a different startup mode.
process_default
pub fn process_default() -> &'static Self
Return the installed process context or initialize a disabled default.
Install enabled settings before the first lookup. Early disabled handles are never implicitly upgraded by logger or plugin construction.
limits
pub fn limits(&self) -> &DiagnosticLimits
Configured capacities, independently of current occupancy or disablement.
source
pub fn source(&self) -> &SourceIdentity
Source incarnation shared by every observation from this context.
reader
pub fn reader(&self) -> DiagnosticsReader
Issue a read capability without materializing or allocating a query page.
snapshot
pub fn snapshot(
&self,
query: &DiagnosticQuery,
) -> Result<SnapshotLease, DiagnosticError>
Capture a bounded page through this context’s reader.
The lease holds a query permit until dropped. Reads never reset counters or pin history; configured disablement is returned explicitly. The query is borrowed only during capture and can be reused after this call.
register_component
pub fn register_component(
&self,
registration: ComponentRegistration<'_>,
) -> Result<ComponentRecorder, DiagnosticError>
Reserve a component vocabulary and return its producer lease.
Admission cannot displace active summaries. The final recorder drop closes the component. Use Self::register_owned_component for explicit close and refresh authority. Disabled mode returns an inert recorder.
register_owned_component
pub fn register_owned_component(
&self,
registration: ComponentRegistration<'_>,
) -> Result<(ComponentOwner, ComponentRecorder), DiagnosticError>
Reserve a component and separately issue owner and producer capabilities.
The owner can close or rotate this registration. Disabled mode issues inert handles without an active identity or backend reservation. Admission failures are explicit and recorded in reserved loss accounting.
subscribe_projection
pub fn subscribe_projection(
&self,
callback: impl Fn(&DiagnosticOutputSummary) + Send + Sync + 'static,
) -> Result<ProjectionGuard, DiagnosticError>
Attach a bounded subscriber to approved operational summaries. Restricted retained evidence is never supplied to projection callbacks.
Callbacks run outside the store lock, may run concurrently, and have isolated panics. Disabled mode retains no callback and returns an inert guard. Arbitrary callback captures and retained copies remain caller-owned.
subscribe_fallible_projection
pub fn subscribe_fallible_projection(
&self,
callback: impl Fn(&DiagnosticOutputSummary) -> Result<(), ProjectionError> + Send + Sync + 'static,
) -> Result<ProjectionGuard, DiagnosticError>
Attach a subscriber that reports bounded conversion or delivery failure.
Errors update projection-loss accounting without undoing numeric acceptance. Separate publication workspaces cannot pin history. Disabled mode retains no callback and returns an inert guard.
memory_usage
pub fn memory_usage(&self) -> DiagnosticMemoryUsage
Inspect reserved backend bytes and occupancy without changing evidence.
Inspection scans admitted slots and detail-block metadata without allocating. Disabled contexts report zero backend capacity. Lightweight facade state, caller-owned copies, thread stacks, and independent outputs are excluded.
Trait Implementations
impl Clone for Diagnostics
impl Clone for Diagnostics
clone
fn clone(&self) -> Diagnostics
clone_from
fn clone_from(&mut self, source: &Self)
impl Debug for Diagnostics
impl Debug for Diagnostics
fmt
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for Diagnostics
impl Default for Diagnostics
default
fn default() -> Self