Class StatsTracker
- java.lang.Object
-
- ru.vyarus.dropwizard.guice.module.context.stat.StatsTracker
-
public final class StatsTracker extends java.lang.ObjectInternal object, used to record startup stats. Guava {#Stopwatch} used for time measurements (also native stopwatch time formatting is used). All metrics are cumulative (all measurements are summed).- Since:
- 27.07.2016
-
-
Constructor Summary
Constructors Constructor Description StatsTracker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcount(Stat name, int count)Inserts value for first call and sum values for consequent calls.java.util.Map<Stat,java.lang.Integer>getCounters()GuiceStatsTrackergetGuiceStats()java.util.Map<Stat,com.google.common.base.Stopwatch>getTimers()voidstartJerseyTimer(Stat name)Special methods for tracking time in jersey scope.voidstopJerseyTimer(Stat name)Called to stop currently measured jersey metric (also stops main guice and jersey timers).com.google.common.base.Stopwatchtimer(Stat name)If measured first time, returns new instance.
-
-
-
Method Detail
-
timer
public com.google.common.base.Stopwatch timer(Stat name)
If measured first time, returns new instance. For second and following measures returns the same instance (to sum measurements). Assumed proper usage: timer stat provided and returned watch correctly stopped.- Parameters:
name- statistic name- Returns:
- timer to measure time
-
count
public void count(Stat name, int count)
Inserts value for first call and sum values for consequent calls.- Parameters:
name- statistics namecount- counter value
-
startJerseyTimer
public void startJerseyTimer(Stat name)
Special methods for tracking time in jersey scope. Such complication used to avoid using 3 different trackers in code. Jersey initialization is performed after bundles run and so out of scope of GuiceBundle.- Parameters:
name- jersey statistics name
-
stopJerseyTimer
public void stopJerseyTimer(Stat name)
Called to stop currently measured jersey metric (also stops main guice and jersey timers).- Parameters:
name- jersey statistic name
-
getTimers
public java.util.Map<Stat,com.google.common.base.Stopwatch> getTimers()
- Returns:
- collected timers map
-
getCounters
public java.util.Map<Stat,java.lang.Integer> getCounters()
- Returns:
- collected counters map
-
getGuiceStats
public GuiceStatsTracker getGuiceStats()
- Returns:
- guice stats logger tracker object
-
-