Class PrometheusGauge
java.lang.Object
eu.rarogsoftware.rarog.platform.core.metrics.prometheus.PrometheusMetric
eu.rarogsoftware.rarog.platform.core.metrics.prometheus.PrometheusGauge
- All Implemented Interfaces:
BasicMetric<Gauge>
,Gauge
-
Nested Class Summary
Nested classes/interfaces inherited from interface eu.rarogsoftware.rarog.platform.api.metrics.Gauge
Gauge.Timer
-
Constructor Summary
ConstructorsConstructorDescriptionPrometheusGauge
(io.prometheus.client.Gauge gauge) PrometheusGauge
(io.prometheus.client.Gauge parent, io.prometheus.client.Gauge.Child child) -
Method Summary
Modifier and TypeMethodDescriptionvoid
decrease
(double amount) Decrement gauge by given amount.void
increase
(double amount) Increment gauge by given amount.Returns 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
set
(double value) Set gauge to given amount.Start a timer to track 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
-
PrometheusGauge
public PrometheusGauge(io.prometheus.client.Gauge gauge) -
PrometheusGauge
public PrometheusGauge(io.prometheus.client.Gauge parent, io.prometheus.client.Gauge.Child child)
-
-
Method Details
-
increase
public void increase(double amount) Description copied from interface:Gauge
Increment gauge by given amount. -
decrease
public void decrease(double amount) Description copied from interface:Gauge
Decrement gauge by given amount. -
set
public void set(double value) Description copied from interface:Gauge
Set gauge to given amount. -
startTimer
Description copied from interface:Gauge
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()
- Specified by:
startTimer
in interfaceGauge
- Returns:
- timer object
-
measureExecutionTime
Description copied from interface:Gauge
Executes runnable code and observes a duration of how long it took to run.- Specified by:
measureExecutionTime
in interfaceGauge
- Parameters:
timeable
- Code that is being timed- Returns:
- Measured duration in seconds for timeable to complete.
-
measureExecutionTime
Description copied from interface:Gauge
Executes runnable code and observes a duration of how long it took to run.- Specified by:
measureExecutionTime
in interfaceGauge
- Parameters:
timeable
- Code that is being timed- Returns:
- result of timeable function
- Throws:
Exception
- exception thrown by timeable function
-
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<Gauge>
- Parameters:
labels
- labels (dimensions) of metric to log
-