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
-
Nested Class Summary
Nested classes/interfaces inherited from interface eu.rarogsoftware.rarog.platform.api.metrics.Histogram
Histogram.Timer -
Constructor Summary
ConstructorsConstructorDescriptionPrometheusHistogram(io.prometheus.client.Histogram delegate) PrometheusHistogram(io.prometheus.client.Histogram delegate, io.prometheus.client.Histogram.Child child) -
Method Summary
Modifier and TypeMethodDescriptionReturns child with the given labels.doublemeasureExecutionTime(Runnable timeable) Executes runnable code and observes a duration of how long it took to run.<T> TmeasureExecutionTime(Callable<T> timeable) Executes runnable code and observes a duration of how long it took to run.voidobserve(double amt) Observes specified value and increments correct bucket.Start a timer to observe a duration.Methods inherited from class eu.rarogsoftware.rarog.platform.core.metrics.prometheus.PrometheusMetric
collect, getCollectorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface eu.rarogsoftware.rarog.platform.api.metrics.BasicMetric
labels
-
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
Description copied from interface:BasicMetricReturns child with the given labels.Must be passed the same number of labels are were passed to
BaseMetricSettings.labels(String...).- Specified by:
labelsin interfaceBasicMetric<Histogram>- Parameters:
labels- labels (dimensions) of metric to log
-
measureExecutionTime
Description copied from interface:HistogramExecutes runnable code and observes a duration of how long it took to run.- Specified by:
measureExecutionTimein interfaceHistogram- Parameters:
timeable- Code that is being timed- Returns:
- Measured duration in seconds for timeable to complete.
-
measureExecutionTime
Description copied from interface:HistogramExecutes runnable code and observes a duration of how long it took to run.- Specified by:
measureExecutionTimein interfaceHistogram- 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:HistogramObserves specified value and increments correct bucket. -
startTimer
Description copied from interface:HistogramStart a timer to observe a duration.Call
Gauge.Timer.stop()at the end of what you want to measure duration of.Gauge.TimerisCloseableto you can use it in try with resources to auto callGauge.Timer.stop()- Specified by:
startTimerin interfaceHistogram- Returns:
- timer object
-