Interface Gauge
- All Superinterfaces:
BasicMetric<Gauge>
- All Known Implementing Classes:
NoopGauge,PrometheusGauge
Gauge metric, to report instantaneous values.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents an event being timed. -
Method Summary
Modifier and TypeMethodDescriptionvoiddecrease(double amount) Decrement gauge by given amount.default voidDecrement gauge by 1.voidincrease(double amount) Increment gauge by given amount.default voidIncrement gauge by 1.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.voidset(double value) Set gauge to given amount.Start a timer to track a duration.Methods inherited from interface eu.rarogsoftware.rarog.platform.api.metrics.BasicMetric
labels, labels
-
Method Details
-
increase
void increase(double amount) Increment gauge by given amount.- Parameters:
amount- amount to add gauge value
-
increment
default void increment()Increment gauge by 1. -
decrease
void decrease(double amount) Decrement gauge by given amount.- Parameters:
amount- amount to add gauge value
-
decrement
default void decrement()Decrement gauge by 1. -
set
void set(double value) Set gauge to given amount.- Parameters:
value- amount to add gauge value
-
startTimer
Gauge.Timer startTimer()Start a timer to track 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
-
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
-