java.lang.Object
net.i2p.router.web.GraphGenerator.CauseTally
- Enclosing class:
GraphGenerator
Count and oldest age for one
GraphGenerator.StaleCause.Deliberately free of router context and of synchronization: a tally is built and read entirely within the single-threaded sync task, and keeping it plain lets the report wording be unit tested without a running router.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longLargest age recorded, in ms.private final GraphGenerator.StaleCauseWhy the data source was reported stale.private intTimes this cause was seen.Names of the listeners in this tally, bounded byGraphGenerator.MAX_NAMED.private booleanWhether_ageMsis measured from the last write rather than from graphing start.private intStale sources without a name.Constructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescription(package private) intcount()How many listeners this cause has been blamed for.(package private) Stringdescribe()Render this cause for the log line.(package private) Stringnames()Render the names recorded for this cause, or an empty string when none were.(package private) voidrecord(long ageMs, boolean sinceLastWrite) Add one listener to this tally.(package private) voidAdd one listener to this tally, naming it.
Field Details
_cause
Why the data source was reported stale._count
private int _countTimes this cause was seen._ageMs
private long _ageMsLargest age recorded, in ms._sinceLastWrite
private boolean _sinceLastWriteWhether_ageMsis measured from the last write rather than from graphing start._names
Names of the listeners in this tally, bounded byGraphGenerator.MAX_NAMED._unnamed
private int _unnamedStale sources without a name.
Constructor Details
CauseTally
CauseTally(GraphGenerator.StaleCause cause) An empty tally for one cause.- Parameters:
cause- the cause this tally counts
Method Details
record
void record(long ageMs, boolean sinceLastWrite) Add one listener to this tally.- Parameters:
ageMs- age fromGraphGenerator.staleAge(long, long, long)sinceLastWrite- true if measured from the last successful write
record
Add one listener to this tally, naming it.The name is what makes the report actionable: a count of stalled listeners with no names leaves the operator to diff every rate on the page against the graphs, which is exactly the work the report exists to save.
- Parameters:
ageMs- age fromGraphGenerator.staleAge(long, long, long)sinceLastWrite- true if measured from the last successful writename- the listener's stat name, or null when not known
count
int count()How many listeners this cause has been blamed for.- Returns:
- number of listeners attributed to this cause
names
String names()Render the names recorded for this cause, or an empty string when none were.- Returns:
- the trailing "name[, name]" clause, without a leading separator
describe
String describe()Render this cause for the log line.- Returns:
cause=countwhen empty, otherwisecause=count (oldest Ns origin)