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.

  • Field Details

    • _cause

      private final GraphGenerator.StaleCause _cause
      Why the data source was reported stale.
    • _count

      private int _count
      Times this cause was seen.
    • _ageMs

      private long _ageMs
      Largest age recorded, in ms.
    • _sinceLastWrite

      private boolean _sinceLastWrite
      Whether _ageMs is measured from the last write rather than from graphing start.
    • _names

      private final List<String> _names
      Names of the listeners in this tally, bounded by GraphGenerator.MAX_NAMED.
    • _unnamed

      private int _unnamed
      Stale 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 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)