> This page is for NeMo Relay, version dev.
> For other versions, use one of these documentation indexes:
> - Latest (v0.10.4) (default): https://docs.nvidia.com/nemo/relay/latest/llms.txt
> - dev: https://docs.nvidia.com/nemo/relay/dev/llms.txt
> - v0.10.4: https://docs.nvidia.com/nemo/relay/v0.10.4/llms.txt
> - v0.9.4: https://docs.nvidia.com/nemo/relay/v0.9.4/llms.txt
> - v0.8.4: https://docs.nvidia.com/nemo/relay/v0.8.4/llms.txt
> - v0.7.3: https://docs.nvidia.com/nemo/relay/v0.7.3/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/relay/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/relay/_mcp/server.

# Module diagnostics

> Bounded, process-local diagnostic evidence, independent of logger startup.

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`.

Bounded, process-local diagnostic evidence, independent of logger startup.

Startup composition chooses collection once. Disabled handles skip lazy work; enabled components reserve summaries before recording. Recent evidence uses a shared circular history and a reclaimable detail pool. Neither history loss nor output delivery changes accepted numeric totals. Diagnostic evidence never assigns readiness, recovery, or deployment health.

The backing-storage budget excludes caller-owned inputs, producer handles, independently decoded snapshot copies, allocator overhead, and user callback captures. Existing operational output and legacy reports have separate budgets.

## Startup and recording

Select settings once before giving producers their handles. Install the chosen context with [`Diagnostics::install_process_default`](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnostics) before using convenience constructors, or inject it explicitly into logging and plugin composition. Neither path requires logging to initialize first.

```rust
use nemo_relay::diagnostics::*;

let diagnostics = Diagnostics::from_settings(
    SourceIdentity {
        instance_id: uuid::Uuid::now_v7(),
        process_id: Some(std::process::id()),
        process_role: "embedded".into(),
        relay_version: env!("CARGO_PKG_VERSION").into(),
    },
    DiagnosticsSettings { enabled: true, ..Default::default() },
)?;
let code = BuiltinDiagnosticCode::Failure(FailureCode::Logging(LoggingFailureCode::SinkWriteFailed));
let recorder = diagnostics.register_component(ComponentRegistration::new("example", &[code]))?;
recorder.record_lazy(|| Observation::new(
    Classification::failure(FailureCode::Logging(LoggingFailureCode::SinkWriteFailed), FailureClass::Io)
        .expect("supported catalogue pair"),
    "Producer-approved safe detail",
    std::num::NonZeroU64::MIN, // occurrence delta, never a cumulative total
))?;
let page = diagnostics.snapshot(&DiagnosticQuery::default())?;
let bounded_json: &[u8] = page.as_bytes();
```

Disabled contexts use the same producer calls and skip their lazy factories; reads return [`DiagnosticError::Disabled`](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-diagnosticerror). Held snapshot leases use a reserved query workspace until dropped. Decoding [`SnapshotLease::to_snapshot`](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-snapshotlease) instead creates an independent caller-owned DTO outside the service's memory budget.

## Re-exports

* `pub use classifiers::PluginErrorClassifier;`

## Modules

* [classifiers](/reference/api/rust-library-reference/nemo-relay/diagnostics/classifiers): Producer-owned pure mappings from existing typed errors to catalogue values. Pure classification for the integrated plugin-operation producer.

## Structs

* [Classification](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-classification): Shared classification payload for producers, projections, and decoded evidence.
* [ClassificationError](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-classificationerror): A cause is missing, forbidden, or unsupported by the selected catalogue code.
* [ComponentIdentity](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-componentidentity): Identity of one registered component within a diagnostic source.
* [ComponentOwner](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-componentowner): Restricted lifecycle capability returned only to the registration owner.
* [ComponentOwnership](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-componentownership): Bounded attribution for a component refresh or an originating observation.
* [ComponentRecorder](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-componentrecorder): Producer capability scoped to one admitted registration.
* [ComponentRegistration](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-componentregistration): Expected codes and attribution are admitted together with the summary.
* [ComponentSnapshot](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-componentsnapshot): One retained row per component registration instance.
* [DiagnosticCapability](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticcapability): Capability coverage, including explicitly deferred producer integrations.
* [DiagnosticCorrelation](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticcorrelation): Optional caller correlation identifiers, excluded from aggregation keys.
* [DiagnosticCount](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticcount): Magnitude of an occurrence or loss counter, including overflow visibility.
* [DiagnosticCounter](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticcounter): Lifetime occurrences for one code in its containing component instance.
* [DiagnosticCoverage](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticcoverage): Explicit evidence, retention, saturation, and producer integration coverage.
* [DiagnosticCursor](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticcursor): Opaque continuation bound to source, capture revision, offsets, and scope.
* [DiagnosticDetail](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticdetail): Restricted optional recent evidence, independent of the accepted numeric summary.
* [DiagnosticDiscovery](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticdiscovery): Side-effect-free discovery, available even when snapshot queries are disabled.
* [DiagnosticEvent](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticevent): One recent observation with its actual class and original configuration attribution.
* [DiagnosticLifetimeSummary](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticlifetimesummary): Fixed lifetime totals and monotonic timing for a context or component instance.
* [DiagnosticLimits](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticlimits): Independent capacities of one diagnostic context. All backing allocations are admitted during startup; these limits are not a whole-process RSS ceiling.
* [DiagnosticLoss](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticloss): Source loss state reserved independently of optional evidence capacity.
* [DiagnosticMemoryUsage](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticmemoryusage): Backing capacity and current occupancy of one context.
* [DiagnosticNumber](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticnumber): Unsigned diagnostic integer serialized losslessly as a decimal string.
* [DiagnosticOrigin](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticorigin): Original bounded configuration attribution carried by one observation.
* [DiagnosticOutputSummary](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticoutputsummary): Allowlisted operational output, constructed independently of retained detail.
* [DiagnosticQuery](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticquery): Portable bounded selection; consumers never reset or mutate evidence.
* [DiagnosticRefreshSummary](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticrefreshsummary): One current resettable counting period, with no retained historical summary.
* [DiagnosticRetention](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticretention): Boundaries of returned retained evidence, separate from cumulative counters.
* [DiagnosticSnapshot](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticsnapshot): Read evidence from one source incarnation, using the canonical snapshot schema.
* [DiagnosticTotals](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnostictotals): Fixed numeric accounting for one explicitly identified lifetime or refresh scope.
* [DiagnosticWindow](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticwindow): Fixed-resolution outcome series for the containing component instance.
* [DiagnosticWindowBucket](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticwindowbucket): An aggregate bucket using component-relative elapsed time, never raw process ticks.
* [DiagnosticWindowCoverage](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticwindowcoverage): Actual observation interval and limitations of a fixed-bucket window.
* [Diagnostics](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnostics): Independent diagnostics context with immutable startup enablement.
* [DiagnosticsReader](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticsreader): Read capability for one context, without recording or lifecycle authority.
* [DiagnosticsSettings](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-diagnosticssettings): Startup-only runtime setting. Collection is compiled normally and off unless the owner enables this context explicitly.
* [ExtensionClassHandle](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-extensionclasshandle): An admitted custom cause descriptor belonging to one registered extension. Its immutable metadata is bounded and does not create another counter series.
* [ExtensionHandle](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-extensionhandle): A registered extension identity. A stale handle cannot create a new code.
* [ExtensionRegistration](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-extensionregistration): Extension vocabulary is scoped to a producer namespace and admitted once.
* [Observation](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-observation): One observation. Its count is a positive input delta, never a cumulative total.
* [OriginRecorder](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-originrecorder): An operation's bounded original configuration attribution.
* [PluginExecutionName](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-pluginexecutionname): A plugin execution mechanism name, preserving values unknown to this reader. Typed conversion accepts only the corresponding catalogue enum.
* [PluginObservationContext](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-pluginobservationcontext): Shared plugin-operation facts for producers, projections, and decoded evidence.
* [PluginPhaseName](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-pluginphasename): A plugin lifecycle phase name, preserving values unknown to this reader. Typed conversion accepts only the corresponding catalogue enum.
* [ProjectionGuard](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-projectionguard): Bounded projection subscription, or inert disabled-mode handle.
* [RecordReceipt](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-recordreceipt): Accepted lifetime and current-summary update, independent of retention and delivery.
* [RemoteDiagnosticOrigin](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-remotediagnosticorigin): Fixed-size provenance retained by an authorized ingestion adapter.
* [SnapshotLease](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-snapshotlease): A bounded serialized page. Dropping the lease returns its workspace permit; it owns copied bytes and never pins retained history or a component lease.
* [SourceIdentity](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-sourceidentity): Identity of one Relay process or explicitly owned runtime incarnation.
* [WindowSettings](/reference/api/rust-library-reference/nemo-relay/diagnostics/struct-windowsettings): Fixed-duration component outcome windows; no code/class Cartesian product.

## Enums

* [BuiltinDiagnosticCode](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-builtindiagnosticcode): Fixed-size canonical authoring value with one authoritative hierarchy.
* [CliFailureCode](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-clifailurecode): Failures at integrated CLI operation boundaries; causes come from producers.
* [CommonPluginFailureCode](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-commonpluginfailurecode): Plugin failures supported by phase-one activation recording.
* [DaemonFailureCode](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-daemonfailurecode): Failures observed by daemon operation owners, independent of health policy.
* [DiagnosticAvailability](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-diagnosticavailability): Availability of evidence, without applying deployment or application health.
* [DiagnosticDetailRef](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-diagnosticdetailref): Borrowed producer-approved detail. A Display source is formatted into capped storage only when the enabled recorder invokes its lazy observation factory.
* [DiagnosticDomain](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-diagnosticdomain): Top-level owning subsystem, derived from its catalogue code.
* [DiagnosticError](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-diagnosticerror): Validation, admission, or availability failure, independent of operational logging.
* [DiagnosticOutcome](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-diagnosticoutcome): Observed operation outcome; severity does not imply this value.
* [DiagnosticSeverity](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-diagnosticseverity): Severity of evidence, independent of an operation's outcome.
* [DiagnosticSummaryScope](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-diagnosticsummaryscope): Scope of summary and outcome-window values in a filtered response.
* [EvidenceDisposition](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-evidencedisposition): Evidence retention is separate from numeric acceptance and output delivery.
* [FailureClass](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-failureclass): Supported general cause, independent of health, retries, and operation outcome.
* [FailureCode](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-failurecode): Failure event hierarchy for integrated producers.
* [LoggingFailureCode](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-loggingfailurecode): Initial Logging failure vocabulary.
* [NoticeCode](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-noticecode): Bounded non-failure observations; they never acquire a failure class.
* [PluginDiagnosticFamily](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-plugindiagnosticfamily): Semantic family of related plugin diagnostic codes.
* [PluginExecution](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-pluginexecution): Producer-authored plugin execution mechanism, excluded from counter identity.
* [PluginFailureCode](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-pluginfailurecode): Plugin failure hierarchy for integrated producers.
* [PluginOperationFailureCode](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-pluginoperationfailurecode): Failures at observed dynamic-plugin operation boundaries.
* [PluginPhase](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-pluginphase): Observed plugin lifecycle phase or policy-gate context, independent of classification.
* [ProjectionError](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-projectionerror): Subscriber conversion or delivery failure after canonical acceptance.
* [RecordOutcome](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-recordoutcome): Accepted collection or intentional startup disablement.
* [SuccessCode](/reference/api/rust-library-reference/nemo-relay/diagnostics/enum-successcode): Explicit successful operations; successes do not recover or clear failures.

## Constants

* [DIAGNOSTIC_CATALOGUE_VERSION](/reference/api/rust-library-reference/nemo-relay/diagnostics/constant-diagnostic-catalogue-version): Stable typed-catalogue revision, independent of the envelope version.
* [DIAGNOSTIC_SCHEMA_VERSION](/reference/api/rust-library-reference/nemo-relay/diagnostics/constant-diagnostic-schema-version): Initial version of the canonical diagnostic snapshot envelope.

## Traits

* [DiagnosticClassifier](/reference/api/rust-library-reference/nemo-relay/diagnostics/trait-diagnosticclassifier): Pure producer behavior: borrow original evidence and return shared classification metadata.

## Type Aliases

* [DiagnosticObservation](/reference/api/rust-library-reference/nemo-relay/diagnostics/type-diagnosticobservation): Explicit authoring name for a borrowed observation.
* [ObservationTime](/reference/api/rust-library-reference/nemo-relay/diagnostics/type-observationtime): UTC wall-clock time when the source observed evidence or captured a snapshot.