Class Gauge.Child

    • Constructor Summary

      Constructors 
      Constructor Description
      Child()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dec()
      Decrement the gauge by 1.
      void dec​(double amt)
      Decrement the gauge by the given amount.
      double get()
      Get the value of the gauge.
      void inc()
      Increment the gauge by 1.
      void inc​(double amt)
      Increment the gauge by the given amount.
      void set​(double val)
      Set the gauge to the given value.
      void setToCurrentTime()
      Set the gauge to the current unixtime.
      double setToTime​(java.lang.Runnable timeable)
      Executes runnable code (e.g.
      <E> E setToTime​(java.util.concurrent.Callable<E> timeable)
      Executes callable code (e.g.
      Gauge.Timer startTimer()
      Start a timer to track a duration.
      • Methods inherited from class java.lang.Object

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

      • Child

        public Child()
    • Method Detail

      • inc

        public void inc()
        Increment the gauge by 1.
      • inc

        public void inc​(double amt)
        Increment the gauge by the given amount.
      • dec

        public void dec()
        Decrement the gauge by 1.
      • dec

        public void dec​(double amt)
        Decrement the gauge by the given amount.
      • set

        public void set​(double val)
        Set the gauge to the given value.
      • setToCurrentTime

        public void setToCurrentTime()
        Set the gauge to the current unixtime.
      • startTimer

        public Gauge.Timer startTimer()
        Start a timer to track a duration.

        Call Gauge.Timer.setDuration() at the end of what you want to measure the duration of.

        This is primarily useful for tracking the durations of major steps of batch jobs, which are then pushed to a PushGateway. For tracking other durations/latencies you should usually use a Summary.

      • setToTime

        public double setToTime​(java.lang.Runnable timeable)
        Executes runnable code (e.g. a Java 8 Lambda) and observes a duration of how long it took to run.
        Parameters:
        timeable - Code that is being timed
        Returns:
        Measured duration in seconds for timeable to complete.
      • setToTime

        public <E> E setToTime​(java.util.concurrent.Callable<E> timeable)
        Executes callable code (e.g. a Java 8 Lambda) and observes a duration of how long it took to run.
        Parameters:
        timeable - Code that is being timed
        Returns:
        Result returned by callable.
      • get

        public double get()
        Get the value of the gauge.