Runtime-sink-file-write-failures
Read the number of write failures recorded by a file-backed RuntimeSink. This helper is useful for direct runtime diagnostics around the file write path.
Interface
pub fn RuntimeSink::file_write_failures(self : RuntimeSink) -> Int {input
self : RuntimeSink- Runtime sink whose write-failure counter should be inspected.
output
Int- Number of recorded write failures.
Explanation
Detailed rules explaining key parameters and behaviors
- Plain
Fileruntime variants report the wrappedFileSinkwrite-failure count. QueuedFileruntime variants forward the metric from the wrapped innerFileSink.- For
QueuedFile, enqueueing a record does not increment this counter by itself. The counter changes only when queued records are actually drained into the inner file sink, such as throughfile_flush(). - Non-file runtime variants return
0. - The counter is cumulative until
file_reset_failure_counters()clears it.
How to Use
Here are some specific examples provided.
When Need Runtime Write-path Diagnostics
When support output should show whether file writes have been failing:
let count = sink.file_write_failures()In this example, callers get a focused signal for direct runtime file write-path health.
When Compare Sink Health After Recovery
When recovery logic should verify whether new failures still occur:
ignore(sink.file_write_failures())In this example, the metric helps measure whether runtime writes improved after intervention.
Error Case
e.g.:
If the runtime sink is not file-backed, the method returns
0.If callers need a fuller view of file health,
file_state()orfile_runtime_state()may be better APIs.
Notes
Use this helper for focused direct runtime write-failure visibility.
Pair it with
file_flush()andfile_flush_failures()when diagnosing queued output-path instability.