Java Code Examples for io.micrometer.core.instrument.distribution.HistogramSnapshot#count()

The following examples show how to use io.micrometer.core.instrument.distribution.HistogramSnapshot#count() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppOpticsMeterRegistry.java    From micrometer with Apache License 2.0 5 votes vote down vote up
private Optional<String> writeTimer(Timer timer) {
    HistogramSnapshot snapshot = timer.takeSnapshot();
    long count = snapshot.count();
    if (count > 0) {
        return Optional.of(write(timer.getId(), "timer",
                Fields.Count.tag(), decimal(count),
                Fields.Sum.tag(), decimal(snapshot.total(getBaseTimeUnit())),
                Fields.Max.tag(), decimal(snapshot.max(getBaseTimeUnit()))));
    }
    return Optional.empty();
}
 
Example 2
Source File: AppOpticsMeterRegistry.java    From micrometer with Apache License 2.0 5 votes vote down vote up
private Optional<String> writeSummary(DistributionSummary summary) {
    HistogramSnapshot snapshot = summary.takeSnapshot();
    if (snapshot.count() > 0) {
        return Optional.of(write(summary.getId(), "distributionSummary",
                Fields.Count.tag(), decimal(summary.count()),
                Fields.Sum.tag(), decimal(summary.totalAmount()),
                Fields.Max.tag(), decimal(summary.max())));
    }
    return Optional.empty();
}
 
Example 3
Source File: Metric.java    From spring-cloud-stream with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new {@link Metric} instance.
 * @param id Meter id
 * @param snapshot instance of HistogramSnapshot
 */
Metric(Meter.Id id, HistogramSnapshot snapshot) {
	this.timestamp = new Date();
	this.id = id;
	this.sum = snapshot.total(TimeUnit.MILLISECONDS);
	this.count = snapshot.count();
	this.mean = snapshot.mean(TimeUnit.MILLISECONDS);
	this.upper = snapshot.max(TimeUnit.MILLISECONDS);
	this.total = snapshot.total(TimeUnit.MILLISECONDS);
}