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 interface
Represents an event being timed. -
Method Summary
Modifier and TypeMethodDescriptionvoid
decrease
(double amount) Decrement gauge by given amount.default void
Decrement gauge by 1.void
increase
(double amount) Increment gauge by given amount.default void
Increment gauge by 1.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
set
(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.Timer
isCloseable
to 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
-