Class StatsInfo
- java.lang.Object
-
- ru.vyarus.dropwizard.guice.module.context.stat.StatsInfo
-
public final class StatsInfo extends java.lang.Object
Provides 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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
count(Stat name)
java.util.List<java.lang.String>
getGuiceStats()
java.lang.String
humanTime(Stat name)
Value is reported in best suited units (e.g. milliseconds, seconds, minutes etc).long
time(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)
-
-
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 (is 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)
-
-