AuditStatistics Class
Assembly: CodeEffects.Rule.Audit.dll
Namespace: CodeEffects.Rule.Audit
Summary
Counts what an AuditRecorder has done since it was made.
Syntax
public sealed class AuditStatistics
You never create this class. AuditRecorder.Statistics returns the one of the recorder. Every counter only grows, is read atomically, and may be read from any thread at any time, for example by a health check or a metrics exporter. The counters belong to one recorder: they do not include records that other processes wrote.
A healthy asynchronous recorder shows Pending close to zero and Dropped at zero. A growing Pending means that the database is slower than your evaluations, or out of reach.
Properties
Captured
Type: System.Int64
Gets the number of evaluations that were recorded: built and handed on to be written to the database.
Discarded
Type: System.Int64
Gets the number of stored records that the database discarded because the version they name was deleted in the meantime, together with its source object. They are included in Stored.
Dropped
Type: System.Int64
Gets the number of records that were lost: turned away by a full queue or journal, not written to the journal, held in memory when the database stayed out of reach as the recorder stopped, or, in Synchronous mode, not written to the database.
JournalFailures
Type: System.Int64
Gets the number of journal writes and reads that failed.
Pending
Type: System.Int64
Gets the number of records that this recorder captured that are neither stored nor dropped yet.
Recovered
Type: System.Int64
Gets the number of stored records that an earlier process, or another process that shares the journal folder, left in the journal. They are included in Stored.
Stored
Type: System.Int64
Gets the number of records the database took, including those recovered from the journal and those it discarded.
StoreFailures
Type: System.Int64
Gets the number of writes to the database that failed. A failed batch is tried again, so this counts attempts, not lost records.
Example
using CodeEffects.Rule.Audit;
AuditStatistics s = audit.Statistics;
Console.WriteLine($"captured {s.Captured}, stored {s.Stored}, dropped {s.Dropped}, pending {s.Pending}");