public class Summary extends SimpleCollector<Summary.Child,Summary>
Example of uses for Summaries include:
Note: Full distribution support is still a work in progress. Currently it reports only the count of observations and their sum, allowing for calculation of the rate of observations and the average observation size.
Example Summaries:
class YourClass {
static final Summary receivedBytes = Summary.build()
.name("requests_size_bytes_total").help("Request size in bytes.").register();
static final Summary requestLatency = Summary.build()
.name("requests_latency_s_total").help("Request latency in seconds.").register();
void processRequest(Request req) {
Summary.Timer requestTimer = requestLatency.startTimer()
try {
// Your code here.
} finally {
receivedBytes.observe(req.size());
requestTimer.observeDuration();
}
}
}
This would allow you to track request rate, average latency and average request size.| Modifier and Type | Class and Description |
|---|---|
static class |
Summary.Builder |
static class |
Summary.Child
The value of a single Summary.
|
static class |
Summary.Timer
Represents an event being timed.
|
Collector.MetricFamilySamples, Collector.Typechildren, fullname, help, labelNames, noLabelsChildMILLISECONDS_PER_SECOND, NANOSECONDS_PER_SECOND| Modifier and Type | Method and Description |
|---|---|
static Summary.Builder |
build()
Return a Builder to allow configuration of a new Summary.
|
List<Collector.MetricFamilySamples> |
collect()
Return all of the metrics of this Collector.
|
protected Summary.Child |
newChild()
Return a new child, workaround for Java generics limitations.
|
void |
observe(double amt)
Observe the given amount on the summary with no labels.
|
Summary.Timer |
startTimer()
Start a timer to track a duration on the summary with no labels.
|
clear, labels, remove, setChildpublic static Summary.Builder build()
protected Summary.Child newChild()
SimpleCollectornewChild in class SimpleCollector<Summary.Child,Summary>public void observe(double amt)
public Summary.Timer startTimer()
Call Summary.Timer.observeDuration() at the end of what you want to measure the duration of.
public List<Collector.MetricFamilySamples> collect()
CollectorCopyright © 2014. All Rights Reserved.