Class PrometheusHistogram

java.lang.Object
eu.rarogsoftware.rarog.platform.core.metrics.prometheus.PrometheusMetric
eu.rarogsoftware.rarog.platform.core.metrics.prometheus.PrometheusHistogram
All Implemented Interfaces:
BasicMetric<Histogram>, Histogram

public class PrometheusHistogram extends PrometheusMetric implements Histogram
  • Constructor Details

    • PrometheusHistogram

      public PrometheusHistogram(io.prometheus.client.Histogram delegate)
    • PrometheusHistogram

      public PrometheusHistogram(io.prometheus.client.Histogram delegate, io.prometheus.client.Histogram.Child child)
  • Method Details

    • labels

      public Histogram 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<Histogram>
      Parameters:
      labels - labels (dimensions) of metric to log
    • measureExecutionTime

      public double measureExecutionTime(Runnable timeable)
      Description copied from interface: Histogram
      Executes runnable code and observes a duration of how long it took to run.
      Specified by:
      measureExecutionTime in interface Histogram
      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: Histogram
      Executes runnable code and observes a duration of how long it took to run.
      Specified by:
      measureExecutionTime in interface Histogram
      Parameters:
      timeable - Code that is being timed
      Returns:
      result of timeable function
      Throws:
      Exception - exception thrown by timeable function
    • observe

      public void observe(double amt)
      Description copied from interface: Histogram
      Observes specified value and increments correct bucket.
      Specified by:
      observe in interface Histogram
      Parameters:
      amt - value to be added to histogram
    • startTimer

      public Histogram.Timer startTimer()
      Description copied from interface: Histogram
      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()

      Specified by:
      startTimer in interface Histogram
      Returns:
      timer object