Interface Histogram

All Superinterfaces:
BasicMetric<Histogram>
All Known Implementing Classes:
NoopHistogram, PrometheusHistogram

public interface Histogram extends BasicMetric<Histogram>
Histogram metric, to track distributions of events.

Note: Each bucket is one timeseries. Many buckets and/or many dimensions with labels can produce large amount of time series, that may cause performance problems.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Represents an event being timed.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Executes runnable code and observes a duration of how long it took to run.
    <T> T
    Executes runnable code and observes a duration of how long it took to run.
    void
    observe(double value)
    Observes specified value and increments correct bucket.
    Start a timer to observe a duration.

    Methods inherited from interface eu.rarogsoftware.rarog.platform.api.metrics.BasicMetric

    labels, labels
  • Method Details

    • measureExecutionTime

      double measureExecutionTime(Runnable timeable)
      Executes runnable code 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.
    • measureExecutionTime

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

      void observe(double value)
      Observes specified value and increments correct bucket.
      Parameters:
      value - value to be added to histogram
    • startTimer

      Histogram.Timer startTimer()
      Start a timer to observe 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()

      Returns:
      timer object