Class Reporter
Records events, ships the ones worth their bytes, and counts them all.
public sealed class Reporter : IDisposable
- Inheritance
-
Reporter
- Implements
- Inherited Members
Remarks
A node that ships every event it produces will spend more on reporting than on the job it was installed to do, and on a satellite link that is money. The reporter keeps counting what it drops, so the aggregate picture survives even when the detail cannot be sent.
Constructors
Reporter(TelemetryLevel)
Creates a reporter that ships events at or above a level.
public Reporter(TelemetryLevel threshold = TelemetryLevel.Info)
Parameters
thresholdTelemetryLevelThe lowest level to ship.
Exceptions
- PamojaException
The native reporter could not be created.
Properties
Dropped
Gets how many events the threshold dropped.
public uint Dropped { get; }
Property Value
Emitted
Gets how many events passed the threshold and were shipped.
public uint Emitted { get; }
Property Value
Threshold
Gets or sets the level this reporter is shipping from.
public TelemetryLevel Threshold { get; set; }
Property Value
Total
Gets how many events have been seen across every level.
public uint Total { get; }
Property Value
Methods
AdaptTo(LinkCost)
Moves the threshold to match what the link now costs.
public void AdaptTo(LinkCost cost)
Parameters
costLinkCostWhat the link currently costs.
Count(TelemetryLevel)
Returns how many events have been seen at a level, shipped or not.
public uint Count(TelemetryLevel level)
Parameters
levelTelemetryLevelThe level to count.
Returns
- uint
The number of events recorded at that level.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Record(TelemetryEvent)
Records an event, returning it when it should be shipped.
public TelemetryEvent? Record(TelemetryEvent telemetryEvent)
Parameters
telemetryEventTelemetryEventThe event that occurred.
Returns
- TelemetryEvent?
The same event when it passed the threshold, or
nullwhen it was counted and dropped.
Remarks
Only the level reaches the native reporter, because the level is the whole of what it decides on. The event comes straight back when it passed.
Snapshot()
Takes a snapshot of the counters to ship in place of the stream.
public TelemetrySnapshot Snapshot()
Returns
- TelemetrySnapshot
The per-level counts and the shipped and dropped totals.
ThresholdFor(LinkCost)
Returns the level a link cost calls for.
public static TelemetryLevel ThresholdFor(LinkCost cost)
Parameters
costLinkCostWhat the link currently costs.
Returns
- TelemetryLevel
The lowest level still worth its bytes at that cost.