Class ScheduledReporter

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      private java.lang.String calculateRateUnit​(java.util.concurrent.TimeUnit unit)  
      void close()
      Stops the reporter and shuts down its thread of execution.
      protected double convertDuration​(double duration)  
      protected double convertRate​(double rate)  
      protected java.lang.String getDurationUnit()  
      protected java.lang.String getRateUnit()  
      void report()
      Report the current values of all metrics in the registry.
      abstract void report​(java.util.SortedMap<java.lang.String,​Gauge> gauges, java.util.SortedMap<java.lang.String,​Counter> counters, java.util.SortedMap<java.lang.String,​Histogram> histograms, java.util.SortedMap<java.lang.String,​Meter> meters, java.util.SortedMap<java.lang.String,​Timer> timers)
      Called periodically by the polling thread.
      void start​(long period, java.util.concurrent.TimeUnit unit)
      Starts the reporter polling at the given period.
      void stop()
      Stops the reporter and shuts down its thread of execution.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • executor

        private final java.util.concurrent.ScheduledExecutorService executor
      • durationFactor

        private final double durationFactor
      • durationUnit

        private final java.lang.String durationUnit
      • rateFactor

        private final double rateFactor
      • rateUnit

        private final java.lang.String rateUnit
    • Constructor Detail

      • ScheduledReporter

        protected ScheduledReporter​(MetricRegistry registry,
                                    java.lang.String name,
                                    MetricFilter filter,
                                    java.util.concurrent.TimeUnit rateUnit,
                                    java.util.concurrent.TimeUnit durationUnit)
        Creates a new ScheduledReporter instance.
        Parameters:
        registry - the MetricRegistry containing the metrics this reporter will report
        name - the reporter's name
        filter - the filter for which metrics to report
    • Method Detail

      • start

        public void start​(long period,
                          java.util.concurrent.TimeUnit unit)
        Starts the reporter polling at the given period.
        Parameters:
        period - the amount of time between polls
        unit - the unit for period
      • stop

        public void stop()
        Stops the reporter and shuts down its thread of execution.
      • close

        public void close()
        Stops the reporter and shuts down its thread of execution.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • report

        public void report()
        Report the current values of all metrics in the registry.
      • report

        public abstract void report​(java.util.SortedMap<java.lang.String,​Gauge> gauges,
                                    java.util.SortedMap<java.lang.String,​Counter> counters,
                                    java.util.SortedMap<java.lang.String,​Histogram> histograms,
                                    java.util.SortedMap<java.lang.String,​Meter> meters,
                                    java.util.SortedMap<java.lang.String,​Timer> timers)
        Called periodically by the polling thread. Subclasses should report all the given metrics.
        Parameters:
        gauges - all of the gauges in the registry
        counters - all of the counters in the registry
        histograms - all of the histograms in the registry
        meters - all of the meters in the registry
        timers - all of the timers in the registry
      • getRateUnit

        protected java.lang.String getRateUnit()
      • getDurationUnit

        protected java.lang.String getDurationUnit()
      • convertDuration

        protected double convertDuration​(double duration)
      • convertRate

        protected double convertRate​(double rate)
      • calculateRateUnit

        private java.lang.String calculateRateUnit​(java.util.concurrent.TimeUnit unit)