java.lang.Object
net.i2p.router.web.HelperBase
net.i2p.router.web.helpers.DebugOverviewHelper
Overview tiles and mini-graphs for the debug page entry point, one tile per debug tab summarizing what that tab shows, linking to it.
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final intNumber of mini-graphs shown, backfilled from other enabled stats.Human-readable labels for the priority stats, for the graph caption; backfilled stats fall back to their raw name.(package private) static final String[]Priority-ordered single-stat graph wishes, after bw.combined.Fields inherited from class HelperBase
_context, _log, _out, CHECKED, PROP_ADVANCED, SELECTEDModifier and TypeFieldDescriptionprotected RouterContextThe router context.protected LogThe log instance.protected WriterThe writer for output.static final StringChecked attribute for HTML checkboxes.static final StringProperty key for advanced mode.static final StringSelected attribute for HTML select options.Constructor Summary
ConstructorsConstructorDescriptionHelper bean that gathers the debug overview's tiles and mini-graphs.Method Summary
Modifier and TypeMethodDescriptionprivate int[]Counts the running apps for the page.private long[]Sum the ratchet stats across distinct client session key managers.private long[]Reads the torrent DHT statistics for the page.private long[]Reads the router's session key counts for the page.private intCounts the running services for the page.private int[]Counts the open streaming connections for the page.private int[]Counts the available updates for the page.(package private) static StringBuild the mini-graph row for the given stats, at the standard graph size with grid but no legend or title - the tiny sidebar template is not used here.buildTiles(int services, int[] apps, int[] updates, long[] skmRouter, long[] skmClients, int[] streams, long[] dht) Build the ring cells in tab order: one per data-bearing debug tab (the DHT tab gets two, fill and fullest) plus one for active streams before it.Build the overview: tile grid then up to four recorded mini-graphs.pickGraphStats(Set<String> enabled) Pick up to GRAPH_COUNT stats to graph: bw.combined first when both bw rates are enabled, then the priority wish list, then a deterministic backfill from any other enabled stats so the row fills out.private static StringOne ratchet-SKM cell: outbound sessions ring with tags and lifetime counters in the tooltip.private static StringWrap a ring cell in a link to its debug tab.Methods inherited from class HelperBase
_t, _t, _t, _x, getChecked, isAdvanced, ngettext, setContextId, storeWriterModifier and TypeMethodDescriptionTranslate a string.Translate a string with a parameter.Translate a string with two parameters.static StringMark a string for extraction by xgettext and translation.protected StringgetChecked(String prop) Get the checked attribute for a boolean property.booleanCheck if advanced mode is enabled.Translate a string with plural forms (ngettext).voidsetContextId(String contextId) Configure this bean to query a particular router context.voidstoreWriter(Writer out) Store the writer for output.
Field Details
GRAPH_STATS
Priority-ordered single-stat graph wishes, after bw.combined.GRAPH_COUNT
static final int GRAPH_COUNTNumber of mini-graphs shown, backfilled from other enabled stats.- See Also:
GRAPH_LABELS
Constructor Details
DebugOverviewHelper
public DebugOverviewHelper()Helper bean that gathers the debug overview's tiles and mini-graphs.
Method Details
buildTiles
static List<String> buildTiles(int services, int[] apps, int[] updates, long[] skmRouter, long[] skmClients, int[] streams, long[] dht) Build the ring cells in tab order: one per data-bearing debug tab (the DHT tab gets two, fill and fullest) plus one for active streams before it. Null stat arrays mean the subsystem reported nothing and the cell degrades to a plain link tile. The SAM and translation tabs get no tile - translation is a pre-generated static report with no live data.- Parameters:
services- count of listening servicesapps- {tracked, running, registered} app counts, or nullupdates- {installed, downloaded, available} counts, or nullskmRouter- ratchet stats, see SessionKeyManager.getDebugStats, or nullskmClients- summed ratchet stats across client managers, or nullstreams- {inbound, outbound} open stream sockets, or nulldht- {keys, buckets, capacity, fullest} bucket stats, or null- Returns:
- one cell html string per tile, never null
skmCell
tile
getOverviewHTML
Build the overview: tile grid then up to four recorded mini-graphs.- Returns:
- the page html, never null
pickGraphStats
Pick up to GRAPH_COUNT stats to graph: bw.combined first when both bw rates are enabled, then the priority wish list, then a deterministic backfill from any other enabled stats so the row fills out. A single stat not in the router'sstat.summarieslist would make viewstat.jsp 400, so only enabled stats are ever shown.- Parameters:
enabled- names of stats with a graph listener- Returns:
- the stat names to graph, at most GRAPH_COUNT, never null
buildGraphs
Build the mini-graph row for the given stats, at the standard graph size with grid but no legend or title - the tiny sidebar template is not used here. bw.combined needs no period parameter (viewstat.jsp resolves it specially) and links to the plain graphs page. A single stat only draws when a period is given, so 60 one-minute buckets = 60 min.- Parameters:
stats- the stats to graph, non-emptynow- current time, used as a cache-busterlabels- translated display labels, stat name to caption- Returns:
- the graph div html, never null
_services
private int _services()Counts the running services for the page.- Returns:
- the service count
_appCounts
private int[] _appCounts()Counts the running apps for the page.- Returns:
- the counts shown on the page
_updateCounts
private int[] _updateCounts()Counts the available updates for the page.- Returns:
- the counts shown on the page
_routerSKM
private long[] _routerSKM()Reads the router's session key counts for the page.- Returns:
- the counts shown on the page
_clientSKMSum
private long[] _clientSKMSum()Sum the ratchet stats across distinct client session key managers.- Returns:
- the summed stats, or null if no client reported any
_streamCounts
private int[] _streamCounts()Counts the open streaming connections for the page.- Returns:
- the counts shown on the page
_dhtStats
private long[] _dhtStats()Reads the torrent DHT statistics for the page.- Returns:
- the counts shown on the page