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.Closeable
Represents an event being timed.
-
-
Field Summary
Fields Modifier and Type Field Description private Histogram.Child
child
private long
start
-
Constructor Summary
Constructors Modifier Constructor Description private
Timer(Histogram.Child child, long start)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Equivalent to callingobserveDuration()
.double
observeDuration()
Observe the amount of time in seconds sinceHistogram.Child.startTimer()
was called.
-
-
-
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.
-
close
public void close()
Equivalent to callingobserveDuration()
.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-