Interface Histogram
- All Superinterfaces:
BasicMetric<Histogram>
- All Known Implementing Classes:
NoopHistogram,PrometheusHistogram
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 ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents an event being timed. -
Method Summary
Modifier and TypeMethodDescriptiondoublemeasureExecutionTime(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 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
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
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.TimerisCloseableto you can use it in try with resources to auto callGauge.Timer.stop()- Returns:
- timer object
-