Class StatsTracker
java.lang.Object
ru.vyarus.dropwizard.guice.module.context.stat.StatsTracker
Internal 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidInserts value for first call and sum values for consequent calls.com.google.common.base.StopwatchdetailTimer(DetailStat name, Class<?> type) Detail stats used to record exact entity metric (like guicey bundle init or run time).getDetails(DetailStat name) 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).voidStop running timer.If measured first time, returns new instance.voidVerify all timers stopped on application complete startup.
-
Constructor Details
-
StatsTracker
public StatsTracker()Create tracker.
-
-
Method Details
-
timer
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
-
stopTimer
Stop running timer.- Parameters:
name- timer name
-
detailTimer
Detail stats used to record exact entity metric (like guicey bundle init or run time).- Parameters:
name- detail nametype- target type- Returns:
- detail timer
-
count
Inserts value for first call and sum values for consequent calls.- Parameters:
name- statistics namecount- counter value
-
startJerseyTimer
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
Called to stop currently measured jersey metric (also stops main guice and jersey timers).- Parameters:
name- jersey statistic name
-
getTimers
- Returns:
- collected timers map
-
getDetails
- Parameters:
name- detail stat name- Returns:
- detail stats
-
getCounters
- Returns:
- collected counters map
-
getGuiceStats
- Returns:
- guice stats logger tracker object
-
verifyTimersDone
public void verifyTimersDone()Verify all timers stopped on application complete startup. As timers are inlinable, it is quite possible to not call stop enough times.
-