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.double
measureExecutionTime
(Runnable timeable) Executes runnable code and observes a duration of how long it took to run.<T> T
measureExecutionTime
(Callable<T> timeable) Executes runnable code and observes a duration of how long it took to run.void
observe
(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, getCollector
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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: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 interfaceBasicMetric<Histogram>
- Parameters:
labels
- labels (dimensions) of metric to log
-
measureExecutionTime
Description copied from interface:Histogram
Executes runnable code and observes a duration of how long it took to run.- Specified by:
measureExecutionTime
in interfaceHistogram
- Parameters:
timeable
- Code that is being timed- Returns:
- Measured duration in seconds for timeable to complete.
-
measureExecutionTime
Description copied from interface:Histogram
Executes runnable code and observes a duration of how long it took to run.- Specified by:
measureExecutionTime
in 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:Histogram
Observes specified value and increments correct bucket. -
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
isCloseable
to you can use it in try with resources to auto callGauge.Timer.stop()
- Specified by:
startTimer
in interfaceHistogram
- Returns:
- timer object
-