Package io.prometheus.client
Class Summary.Timer
- java.lang.Object
-
- io.prometheus.client.Summary.Timer
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Enclosing class:
- Summary
public static class Summary.Timer extends java.lang.Object implements java.io.Closeable
Represents an event being timed.
-
-
Field Summary
Fields Modifier and Type Field Description private Summary.Child
child
private long
start
-
Constructor Summary
Constructors Modifier Constructor Description private
Timer(Summary.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 sinceSummary.Child.startTimer()
was called.
-
-
-
Field Detail
-
child
private final Summary.Child child
-
start
private final long start
-
-
Constructor Detail
-
Timer
private Timer(Summary.Child child, long start)
-
-
Method Detail
-
observeDuration
public double observeDuration()
Observe the amount of time in seconds sinceSummary.Child.startTimer()
was called.- Returns:
- Measured duration in seconds since
Summary.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
-
-