Class Gauge.Child

    • Constructor Detail

    • 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​(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​(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.