Class StatsInfo
- java.lang.Object
-
- ru.vyarus.dropwizard.guice.module.context.stat.StatsInfo
-
public final class StatsInfo extends java.lang.ObjectProvides access to starts collected at startup. Instance bound to guice context and available for injection. Prefer using throughGuiceyConfigurationInfo.getStats().- Since:
- 28.07.2016
-
-
Constructor Summary
Constructors Constructor Description StatsInfo(StatsTracker tracker)Create info.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcount(Stat name)java.time.Durationduration(Stat name)java.util.Map<java.lang.Class<?>,java.time.Duration>getDetailedStats(DetailStat stat)Detailed stats used to track duration for exact entity (command or guicey bundle).java.util.List<java.lang.String>getGuiceStats()java.lang.StringhumanTime(Stat name)Value is reported in best suited units (e.g. milliseconds, seconds, minutes etc).longtime(Stat name)Note: time stats are measured in nanoseconds and after conversion to millisecond it may become 0.
-
-
-
Constructor Detail
-
StatsInfo
public StatsInfo(StatsTracker tracker)
Create info.- Parameters:
tracker- tracker
-
-
Method Detail
-
time
public long time(Stat name)
Note: time stats are measured in nanoseconds and after conversion to millisecond it may become 0. Usually it makes no sense to log such small values, and 0 value makes it easier to filter out them. In contrast, when usinghumanTime(Stat)for such timers, correct value will be printed.- Parameters:
name- statistic name- Returns:
- collected time in milliseconds or 0 (if stat value is not available)
- Throws:
java.lang.IllegalStateException- if provided stat is not time stat
-
duration
public java.time.Duration duration(Stat name)
- Parameters:
name- statistic name- Returns:
- collected time duration or 0 (if stat value is not available)
- Throws:
java.lang.IllegalStateException- if provided stat is not time stat
-
humanTime
public java.lang.String humanTime(Stat name)
Value is reported in best suited units (e.g. milliseconds, seconds, minutes etc).- Parameters:
name- statistic name- Returns:
- human readable (formatted) timer value or 0 (if stat value is not available)
- Throws:
java.lang.IllegalStateException- if provided stat is not time stat
-
count
public int count(Stat name)
- Parameters:
name- statistic name- Returns:
- stat value or 0 (if stat value is not available)
- Throws:
java.lang.IllegalStateException- if provided stat is not count stat
-
getGuiceStats
public java.util.List<java.lang.String> getGuiceStats()
- Returns:
- guice injector creation logs (intercepted)
-
getDetailedStats
public java.util.Map<java.lang.Class<?>,java.time.Duration> getDetailedStats(DetailStat stat)
Detailed stats used to track duration for exact entity (command or guicey bundle).- Parameters:
stat- required stat- Returns:
- all collected detailed stats of type
-
-