Package io.prometheus.client
Class Histogram.Timer
- java.lang.Object
-
- io.prometheus.client.Histogram.Timer
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Enclosing class:
- Histogram
public static class Histogram.Timer extends java.lang.Object implements java.io.CloseableRepresents an event being timed.
-
-
Field Summary
Fields Modifier and Type Field Description private Histogram.Childchildprivate longstart
-
Constructor Summary
Constructors Modifier Constructor Description privateTimer(Histogram.Child child, long start)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Equivalent to callingobserveDuration().doubleobserveDuration()Observe the amount of time in seconds sinceHistogram.Child.startTimer()was called.doubleobserveDurationWithExemplar(java.lang.String... exemplarLabels)doubleobserveDurationWithExemplar(java.util.Map<java.lang.String,java.lang.String> exemplarLabels)
-
-
-
Field Detail
-
child
private final Histogram.Child child
-
start
private final long start
-
-
Constructor Detail
-
Timer
private Timer(Histogram.Child child, long start)
-
-
Method Detail
-
observeDuration
public double observeDuration()
Observe the amount of time in seconds sinceHistogram.Child.startTimer()was called.- Returns:
- Measured duration in seconds since
Histogram.Child.startTimer()was called.
-
observeDurationWithExemplar
public double observeDurationWithExemplar(java.lang.String... exemplarLabels)
-
observeDurationWithExemplar
public double observeDurationWithExemplar(java.util.Map<java.lang.String,java.lang.String> exemplarLabels)
-
close
public void close()
Equivalent to callingobserveDuration().- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-