java.lang.Object
eu.rarogsoftware.rarog.platform.core.metrics.noop.NoopGauge
All Implemented Interfaces:
BasicMetric<Gauge>, Gauge

class NoopGauge extends Object implements Gauge
  • Constructor Details

    • NoopGauge

      NoopGauge()
  • Method Details

    • increase

      public void increase(double amount)
      Description copied from interface: Gauge
      Increment gauge by given amount.
      Specified by:
      increase in interface Gauge
      Parameters:
      amount - amount to add gauge value
    • decrease

      public void decrease(double amount)
      Description copied from interface: Gauge
      Decrement gauge by given amount.
      Specified by:
      decrease in interface Gauge
      Parameters:
      amount - amount to add gauge value
    • set

      public void set(double value)
      Description copied from interface: Gauge
      Set gauge to given amount.
      Specified by:
      set in interface Gauge
      Parameters:
      value - amount to add gauge value
    • startTimer

      public Gauge.Timer startTimer()
      Description copied from interface: Gauge
      Start a timer to track a duration.

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

      Gauge.Timer is Closeable to you can use it in try with resources to auto call Gauge.Timer.stop()

      Specified by:
      startTimer in interface Gauge
      Returns:
      timer object
    • measureExecutionTime

      public double measureExecutionTime(Runnable timeable)
      Description copied from interface: Gauge
      Executes runnable code and observes a duration of how long it took to run.
      Specified by:
      measureExecutionTime in interface Gauge
      Parameters:
      timeable - Code that is being timed
      Returns:
      Measured duration in seconds for timeable to complete.
    • measureExecutionTime

      public <T> T measureExecutionTime(Callable<T> timeable) throws Exception
      Description copied from interface: Gauge
      Executes runnable code and observes a duration of how long it took to run.
      Specified by:
      measureExecutionTime in interface Gauge
      Parameters:
      timeable - Code that is being timed
      Returns:
      result of timeable function
      Throws:
      Exception - exception thrown by timeable function
    • labels

      public Gauge labels(String... labels)
      Description copied from interface: BasicMetric
      Returns child with the given labels.

      Must be passed the same number of labels are were passed to BaseMetricSettings.labels(String...).

      Specified by:
      labels in interface BasicMetric<Gauge>
      Parameters:
      labels - labels (dimensions) of metric to log