Package io.prometheus.client
Class Histogram.Child
- java.lang.Object
-
- io.prometheus.client.Histogram.Child
-
- Enclosing class:
- Histogram
public static class Histogram.Child extends java.lang.ObjectThe value of a single Histogram.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 classHistogram.Child.Value
-
Field Summary
Fields Modifier and Type Field Description private DoubleAdder[]cumulativeCountsprivate DoubleAddersumprivate double[]upperBounds
-
Constructor Summary
Constructors Modifier Constructor Description privateChild(double[] buckets)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Histogram.Child.Valueget()Get the value of the Histogram.voidobserve(double amt)Observe the given amount.Histogram.TimerstartTimer()Start a timer to track a duration.doubletime(java.lang.Runnable timeable)Executes runnable code (e.g.<E> Etime(java.util.concurrent.Callable<E> timeable)Executes callable code (e.g.
-
-
-
Field Detail
-
upperBounds
private final double[] upperBounds
-
cumulativeCounts
private final DoubleAdder[] cumulativeCounts
-
sum
private final DoubleAdder sum
-
-
Method Detail
-
time
public double time(java.lang.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(java.util.concurrent.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.
-
startTimer
public Histogram.Timer startTimer()
Start a timer to track a duration.Call
Histogram.Timer.observeDuration()at the end of what you want to measure the duration of.
-
get
public Histogram.Child.Value get()
Get the value of the Histogram.Warning: The definition of
Histogram.Child.Valueis subject to change.
-
-