java.lang.Object
net.i2p.router.web.GraphGenerator.CauseTally
Enclosing class:
GraphGenerator

static final class GraphGenerator.CauseTallyextends Object
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.

  • Constructor Summary

    Constructors
    Constructor
    Description
    An empty tally for one cause.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    (package private) int
    How many listeners this cause has been blamed for.
    (package private) String
    Render this cause for the log line.
    (package private) String
    Render the names recorded for this cause, or an empty string when none were.
    (package private) void
    record(long ageMs, boolean sinceLastWrite)
    Add one listener to this tally.
    (package private) void
    record(long ageMs, boolean sinceLastWrite, String name)
    Add one listener to this tally, naming it.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 from GraphGenerator.staleAge(long, long, long)
      sinceLastWrite - true if measured from the last successful write
    • record

      void record(long ageMs, boolean sinceLastWrite, String name)
      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 from GraphGenerator.staleAge(long, long, long)
      sinceLastWrite - true if measured from the last successful write
      name - 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=count when empty, otherwise cause=count (oldest Ns origin)