Package io.prometheus.client
Class Summary.Child
- java.lang.Object
-
- io.prometheus.client.Summary.Child
-
- Enclosing class:
- Summary
public static class Summary.Child extends Object
The value of a single Summary.Warning: References to a Child become invalid after using
SimpleCollector.remove(java.lang.String...)
orSimpleCollector.clear()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Summary.Child.Value
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Summary.Child.Value
get()
Get the value of the Summary.void
observe(double amt)
Observe the given amount.Summary.Timer
startTimer()
Start a timer to track a duration.double
time(Runnable timeable)
Executes runnable code (e.g.<E> E
time(Callable<E> timeable)
Executes callable code (e.g.
-
-
-
Method Detail
-
time
public double time(Runnable timeable)
Executes runnable code (e.g. a Java 8 Lambda) and observes a duration of how long it took to run.- Parameters:
timeable
- Code that is being timed- Returns:
- Measured duration in seconds for timeable to complete.
-
time
public <E> E time(Callable<E> timeable)
Executes callable code (e.g. a Java 8 Lambda) and observes a duration of how long it took to run.- Parameters:
timeable
- Code that is being timed- Returns:
- Result returned by callable.
-
observe
public void observe(double amt)
Observe the given amount.- Parameters:
amt
- in most cases amt should be >= 0. Negative values are supported, but you should read https://prometheus.io/docs/practices/histograms/#count-and-sum-of-observations for implications and alternatives.
-
startTimer
public Summary.Timer startTimer()
Start a timer to track a duration.Call
Summary.Timer.observeDuration()
at the end of what you want to measure the duration of.
-
get
public Summary.Child.Value get()
Get the value of the Summary.Warning: The definition of
Summary.Child.Value
is subject to change.
-
-