java.lang.Object
ru.vyarus.dropwizard.guice.module.context.stat.StatsInfo

public final class StatsInfo extends 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
  • Constructor Details

    • StatsInfo

      public StatsInfo(StatsTracker tracker)
      Create info.
      Parameters:
      tracker - tracker
  • Method Details

    • 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:
      IllegalStateException - if provided stat is not time stat
    • duration

      public Duration duration(Stat name)
      Parameters:
      name - statistic name
      Returns:
      collected time duration or 0 (if stat value is not available)
      Throws:
      IllegalStateException - if provided stat is not time stat
    • humanTime

      public 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:
      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:
      IllegalStateException - if provided stat is not count stat
    • getGuiceStats

      public List<String> getGuiceStats()
      Returns:
      guice injector creation logs (intercepted)
    • getDetailedStats

      public Map<Class<?>,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