Package io.prometheus.client
Class Gauge.Timer
- java.lang.Object
-
- io.prometheus.client.Gauge.Timer
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Enclosing class:
- Gauge
public static class Gauge.Timer extends java.lang.Object implements java.io.CloseableRepresents an event being timed.
-
-
Field Summary
Fields Modifier and Type Field Description private Gauge.Childchildprivate longstart
-
Constructor Summary
Constructors Modifier Constructor Description privateTimer(Gauge.Child child)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Equivalent to callingsetDuration().doublesetDuration()Set the amount of time in seconds sinceGauge.Child.startTimer()was called.
-
-
-
Field Detail
-
child
private final Gauge.Child child
-
start
private final long start
-
-
Constructor Detail
-
Timer
private Timer(Gauge.Child child)
-
-
Method Detail
-
setDuration
public double setDuration()
Set the amount of time in seconds sinceGauge.Child.startTimer()was called.- Returns:
- Measured duration in seconds since
Gauge.Child.startTimer()was called.
-
close
public void close()
Equivalent to callingsetDuration().- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-