Class 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 through GuiceyConfigurationInfo.getStats().
    Since:
    28.07.2016
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int count​(Stat name)  
      java.time.Duration duration​(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.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 using humanTime(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