当前位置: 首页>>代码示例>>Java>>正文


Java Snapshot.size方法代码示例

本文整理汇总了Java中com.codahale.metrics.Snapshot.size方法的典型用法代码示例。如果您正苦于以下问题:Java Snapshot.size方法的具体用法?Java Snapshot.size怎么用?Java Snapshot.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.codahale.metrics.Snapshot的用法示例。


在下文中一共展示了Snapshot.size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processTimer

import com.codahale.metrics.Snapshot; //导入方法依赖的package包/类
/**
 * The {@link Snapshot} values of {@link Timer} are reported as {@link StatisticSet} after conversion. The
 * conversion is done using the duration factor, which is deduced from the set duration unit.
 * <p>
 * Please note, the reported values submitted only if they show some data (greater than zero) in order to:
 * <p>
 * 1. save some money
 * 2. prevent com.amazonaws.services.cloudwatch.model.InvalidParameterValueException if empty {@link Snapshot}
 * is submitted
 * <p>
 * If {@link Builder#withZeroValuesSubmission()} is {@code true}, then all values will be submitted
 *
 * @see Timer#getSnapshot
 * @see #getDurationUnit
 * @see #convertDuration(double)
 */
private void processTimer(final String metricName, final Timer timer, final List<MetricDatum> metricData) {
    final Snapshot snapshot = timer.getSnapshot();

    if (builder.withZeroValuesSubmission || snapshot.size() > 0) {
        for (final Percentile percentile : builder.percentiles) {
            final double convertedDuration = convertDuration(snapshot.getValue(percentile.getQuantile()));
            stageMetricDatum(true, metricName, convertedDuration, durationUnit, percentile.getDesc(), metricData);
        }
    }

    // prevent empty snapshot from causing InvalidParameterValueException
    if (snapshot.size() > 0) {
        final String formattedDuration = String.format(" [in-%s]", getDurationUnit());
        stageMetricDatum(builder.withArithmeticMean, metricName, convertDuration(snapshot.getMean()), durationUnit, DIMENSION_SNAPSHOT_MEAN + formattedDuration, metricData);
        stageMetricDatum(builder.withStdDev, metricName, convertDuration(snapshot.getStdDev()), durationUnit, DIMENSION_SNAPSHOT_STD_DEV + formattedDuration, metricData);
        stageMetricDatumWithConvertedSnapshot(builder.withStatisticSet, metricName, snapshot, durationUnit, metricData);
    }
}
 
开发者ID:azagniotov,项目名称:codahale-aggregated-metrics-cloudwatch-reporter,代码行数:35,代码来源:CloudWatchReporter.java

示例2: processHistogram

import com.codahale.metrics.Snapshot; //导入方法依赖的package包/类
/**
 * The {@link Snapshot} values of {@link Histogram} are reported as {@link StatisticSet} raw. In other words, the
 * conversion using the duration factor does NOT apply.
 * <p>
 * Please note, the reported values submitted only if they show some data (greater than zero) in order to:
 * <p>
 * 1. save some money
 * 2. prevent com.amazonaws.services.cloudwatch.model.InvalidParameterValueException if empty {@link Snapshot}
 * is submitted
 * <p>
 * If {@link Builder#withZeroValuesSubmission()} is {@code true}, then all values will be submitted
 *
 * @see Histogram#getSnapshot
 */
private void processHistogram(final String metricName, final Histogram histogram, final List<MetricDatum> metricData) {
    final Snapshot snapshot = histogram.getSnapshot();

    if (builder.withZeroValuesSubmission || snapshot.size() > 0) {
        for (final Percentile percentile : builder.percentiles) {
            final double value = snapshot.getValue(percentile.getQuantile());
            stageMetricDatum(true, metricName, value, StandardUnit.None, percentile.getDesc(), metricData);
        }
    }

    // prevent empty snapshot from causing InvalidParameterValueException
    if (snapshot.size() > 0) {
        stageMetricDatum(builder.withArithmeticMean, metricName, snapshot.getMean(), StandardUnit.None, DIMENSION_SNAPSHOT_MEAN, metricData);
        stageMetricDatum(builder.withStdDev, metricName, snapshot.getStdDev(), StandardUnit.None, DIMENSION_SNAPSHOT_STD_DEV, metricData);
        stageMetricDatumWithRawSnapshot(builder.withStatisticSet, metricName, snapshot, StandardUnit.None, metricData);
    }
}
 
开发者ID:azagniotov,项目名称:codahale-aggregated-metrics-cloudwatch-reporter,代码行数:32,代码来源:CloudWatchReporter.java

示例3: reportTimer

import com.codahale.metrics.Snapshot; //导入方法依赖的package包/类
private void reportTimer(String name, Timer timer, long timestamp) {
	if (canSkipMetric(name, timer)) {
		return;
	}
	final Snapshot snapshot = timer.getSnapshot();
	Object[] p = pointsTimer[0];
	p[0] = influxdb.convertTimestamp(timestamp);
	p[1] = snapshot.size();
	p[2] = convertDuration(snapshot.getMin());
	p[3] = convertDuration(snapshot.getMax());
	p[4] = convertDuration(snapshot.getMean());
	p[5] = convertDuration(snapshot.getStdDev());
	p[6] = convertDuration(snapshot.getMedian());
	p[7] = convertDuration(snapshot.get75thPercentile());
	p[8] = convertDuration(snapshot.get95thPercentile());
	p[9] = convertDuration(snapshot.get99thPercentile());
	p[10] = convertDuration(snapshot.get999thPercentile());
	p[11] = convertRate(timer.getOneMinuteRate());
	p[12] = convertRate(timer.getFiveMinuteRate());
	p[13] = convertRate(timer.getFifteenMinuteRate());
	p[14] = convertRate(timer.getMeanRate());
	p[15] = timer.getCount();
	assert (p.length == COLUMNS_TIMER.length);
	influxdb.appendSeries(prefix, name, ".timer", COLUMNS_TIMER, pointsTimer);
}
 
开发者ID:davidB,项目名称:metrics-influxdb,代码行数:26,代码来源:ReporterV08.java

示例4: reportHistogram

import com.codahale.metrics.Snapshot; //导入方法依赖的package包/类
private void reportHistogram(String name, Histogram histogram, long timestamp) {
	if (canSkipMetric(name, histogram)) {
		return;
	}
	final Snapshot snapshot = histogram.getSnapshot();
	Object[] p = pointsHistogram[0];
	p[0] = influxdb.convertTimestamp(timestamp);
	p[1] = snapshot.size();
	p[2] = snapshot.getMin();
	p[3] = snapshot.getMax();
	p[4] = snapshot.getMean();
	p[5] = snapshot.getStdDev();
	p[6] = snapshot.getMedian();
	p[7] = snapshot.get75thPercentile();
	p[8] = snapshot.get95thPercentile();
	p[9] = snapshot.get99thPercentile();
	p[10] = snapshot.get999thPercentile();
	p[11] = histogram.getCount();
	assert (p.length == COLUMNS_HISTOGRAM.length);
	influxdb.appendSeries(prefix, name, ".histogram", COLUMNS_HISTOGRAM, pointsHistogram);
}
 
开发者ID:davidB,项目名称:metrics-influxdb,代码行数:22,代码来源:ReporterV08.java

示例5: serialise

import com.codahale.metrics.Snapshot; //导入方法依赖的package包/类
public MetricsHistogram serialise(String name, Histogram histo)
{
	Snapshot snapshot = histo.getSnapshot();
	final long count = histo.getCount();
	return new MetricsHistogram(name,
	                            count,
	                            snapshot.size(),
	                            snapshot.getMin(),
	                            snapshot.getMax(),
	                            snapshot.getStdDev(),
	                            snapshot.getMean(),
	                            snapshot.getMedian(),
	                            snapshot.get75thPercentile(),
	                            snapshot.get95thPercentile(),
	                            snapshot.get98thPercentile(),
	                            snapshot.get99thPercentile(),
	                            snapshot.get999thPercentile());
}
 
开发者ID:petergeneric,项目名称:stdlib,代码行数:19,代码来源:MetricSerialiser.java

示例6: reportTimer

import com.codahale.metrics.Snapshot; //导入方法依赖的package包/类
private void reportTimer(String key, Collection<MetricDatum> data, Map.Entry<String, Timer> met) {
    Timer timer = met.getValue();
    Snapshot snapshot = timer.getSnapshot();
    if (reportAggregates) {
        reportAggregate(key, data, "count", null, timer.getCount());
        reportAggregate(key, data, "rate", "1minute", timer.getOneMinuteRate());
        reportAggregate(key, data, "rate", "5minute", timer.getFiveMinuteRate());
        reportAggregate(key, data, "rate", "15minute", timer.getFifteenMinuteRate());
        reportAggregate(key, data, "rate", "mean", timer.getMeanRate());
        reportSnapshot(data, snapshot, key);
    } else {
        // if no data, don't bother Amazon with it.
        if (snapshot.size() == 0) {
            return;
        }
        double sum = 0;
        for (double val : snapshot.getValues()) {
            sum += val;
        }
        // Metrics works in Nanoseconds, which is not one of Amazon's favorites.
        double max = (double) TimeUnit.NANOSECONDS.toMicros(snapshot.getMax());
        double min = (double) TimeUnit.NANOSECONDS.toMicros(snapshot.getMin());
        double sumMicros = TimeUnit.NANOSECONDS.toMicros((long) sum);
        StatisticSet stats = new StatisticSet()
                .withMaximum(max)
                .withMinimum(min)
                .withSum(sumMicros)
                .withSampleCount((double) snapshot.getValues().length);
        if (LOG.isDebugEnabled()) {
            LOG.debug("timer {}: {}", met.getKey(), stats);
        }
        data.add(new MetricDatum().withMetricName(met.getKey())
                .withDimensions(dimensions)
                .withStatisticValues(stats)
                .withUnit(StandardUnit.Microseconds));
    }
}
 
开发者ID:basis-technology-corp,项目名称:metrics-cloudwatch-reporter,代码行数:38,代码来源:CloudWatchReporter.java

示例7: reportHistogram

import com.codahale.metrics.Snapshot; //导入方法依赖的package包/类
private void reportHistogram(Collection<MetricDatum> data, Map.Entry<String, Histogram> meh) {
    Snapshot snapshot = meh.getValue().getSnapshot();

    if (reportAggregates) {
        String key = meh.getKey();
        reportSnapshot(data, snapshot, key);
    } else {
        // if no data, don't bother Amazon with it.
        if (snapshot.size() == 0) {
            return;
        }
        double sum = 0;
        for (double val : snapshot.getValues()) {
            sum += val;
        }
        StatisticSet stats = new StatisticSet().withMaximum((double) snapshot.getMax())
                .withMinimum((double) snapshot.getMin())
                .withSum(sum)
                .withSampleCount((double) snapshot.getValues().length);
        if (LOG.isDebugEnabled()) {
            LOG.debug("histogram {}: {}", meh.getKey(), stats);
        }
        data.add(new MetricDatum().withMetricName(meh.getKey())
                .withDimensions(dimensions)
                .withStatisticValues(stats));
    }
}
 
开发者ID:basis-technology-corp,项目名称:metrics-cloudwatch-reporter,代码行数:28,代码来源:CloudWatchReporter.java


注:本文中的com.codahale.metrics.Snapshot.size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。