本文整理了Java中org.apache.flink.metrics.Histogram
类的一些代码示例,展示了Histogram
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Histogram
类的具体详情如下:
包路径:org.apache.flink.metrics.Histogram
类名称:Histogram
[英]Histogram interface to be used with Flink's metrics system.
The histogram allows to record values, get the current count of recorded values and create histogram statistics for the currently seen elements.
[中]用于Flink度量系统的直方图界面。
直方图允许记录值,获取记录值的当前计数,并为当前看到的元素创建直方图统计信息。
代码示例来源:origin: apache/flink
@Override
public Snapshot getSnapshot() {
return new HistogramStatisticsWrapper(histogram.getStatistics());
}
}
代码示例来源:origin: apache/flink
private void addSamples(final List<String> labelValues, final Histogram histogram, final List<MetricFamilySamples.Sample> samples) {
samples.add(new MetricFamilySamples.Sample(metricName + "_count",
labelNamesWithQuantile.subList(0, labelNamesWithQuantile.size() - 1), labelValues, histogram.getCount()));
for (final Double quantile : QUANTILES) {
samples.add(new MetricFamilySamples.Sample(metricName, labelNamesWithQuantile,
addToList(labelValues, quantile.toString()),
histogram.getStatistics().getQuantile(quantile)));
}
}
}
代码示例来源:origin: apache/flink
@Override
public void update(long value) {
histogram.update(value);
}
代码示例来源:origin: apache/flink
@Override
public long getCount() {
return histogram.getCount();
}
代码示例来源:origin: apache/flink
@Override
public long getCount() {
return histogram.getCount();
}
代码示例来源:origin: apache/flink
@Override
public long getMin() {
return histogram.getStatistics().getMin();
}
代码示例来源:origin: apache/flink
private void reportHistogram(final String name, final Histogram histogram) {
if (histogram != null) {
HistogramStatistics statistics = histogram.getStatistics();
if (statistics != null) {
send(prefix(name, "count"), String.valueOf(histogram.getCount()));
send(prefix(name, "max"), String.valueOf(statistics.getMax()));
send(prefix(name, "min"), String.valueOf(statistics.getMin()));
send(prefix(name, "mean"), String.valueOf(statistics.getMean()));
send(prefix(name, "stddev"), String.valueOf(statistics.getStdDev()));
send(prefix(name, "p50"), String.valueOf(statistics.getQuantile(0.5)));
send(prefix(name, "p75"), String.valueOf(statistics.getQuantile(0.75)));
send(prefix(name, "p95"), String.valueOf(statistics.getQuantile(0.95)));
send(prefix(name, "p98"), String.valueOf(statistics.getQuantile(0.98)));
send(prefix(name, "p99"), String.valueOf(statistics.getQuantile(0.99)));
send(prefix(name, "p999"), String.valueOf(statistics.getQuantile(0.999)));
}
}
}
代码示例来源:origin: apache/flink
@Test
public void testLatencyStatsOperator() {
testLatencyStats(LatencyStats.Granularity.OPERATOR, registrations -> {
Assert.assertEquals(2, registrations.size());
{
final Tuple2<String, Histogram> registration = registrations.get(0);
assertName(registration.f0, SOURCE_ID_1);
Assert.assertEquals(3, registration.f1.getCount());
}
{
final Tuple2<String, Histogram> registration = registrations.get(1);
assertName(registration.f0, SOURCE_ID_2);
Assert.assertEquals(2, registration.f1.getCount());
}
});
}
代码示例来源:origin: com.alibaba.blink/flink-metrics-dropwizard
@Override
public void update(long value) {
histogram.update(value);
}
代码示例来源:origin: apache/flink
@Override
public double get95thPercentile() {
return histogram.getStatistics().getQuantile(0.95);
}
代码示例来源:origin: apache/flink
@Test
public void testLatencyStatsSingle() {
testLatencyStats(LatencyStats.Granularity.SINGLE, registrations -> {
Assert.assertEquals(1, registrations.size());
{
final Tuple2<String, Histogram> registration = registrations.get(0);
assertName(registration.f0);
Assert.assertEquals(5, registration.f1.getCount());
}
});
}
代码示例来源:origin: com.alibaba.blink/flink-runtime
public void update(long value) {
count.inc();
sum += value;
histogram.update(value);
}
代码示例来源:origin: apache/flink
@Override
public double get99thPercentile() {
return histogram.getStatistics().getQuantile(0.99);
}
代码示例来源:origin: apache/flink
@Test
public void testLatencyStatsSubtask() {
testLatencyStats(LatencyStats.Granularity.SUBTASK, registrations -> {
Assert.assertEquals(4, registrations.size());
{
final Tuple2<String, Histogram> registration = registrations.get(0);
assertName(registration.f0, SOURCE_ID_1, 0);
Assert.assertEquals(2, registration.f1.getCount());
}
{
final Tuple2<String, Histogram> registration = registrations.get(1);
assertName(registration.f0, SOURCE_ID_1, 1);
Assert.assertEquals(1, registration.f1.getCount());
}
{
final Tuple2<String, Histogram> registration = registrations.get(2);
assertName(registration.f0, SOURCE_ID_2, 2);
Assert.assertEquals(1, registration.f1.getCount());
}
{
final Tuple2<String, Histogram> registration = registrations.get(3);
assertName(registration.f0, SOURCE_ID_2, 3);
Assert.assertEquals(1, registration.f1.getCount());
}
});
}
代码示例来源:origin: com.alibaba.blink/flink-runtime
boolean result = attempt.switchToRunning();
if(result) {
taskDeployMetrics.update(
attempt.getStateTimestamp(ExecutionState.RUNNING) - attempt.getStateTimestamp(ExecutionState.DEPLOYING));
代码示例来源:origin: apache/flink
@Override
public long getMax() {
return histogram.getStatistics().getMax();
}
代码示例来源:origin: com.alibaba.blink/flink-metrics-dropwizard
@Override
public long getCount() {
return histogram.getCount();
}
代码示例来源:origin: apache/flink
@Override
public double getMedian() {
return histogram.getStatistics().getQuantile(0.5);
}
代码示例来源:origin: org.apache.flink/flink-metrics-jmx
@Override
public long getCount() {
return histogram.getCount();
}
代码示例来源:origin: apache/flink
@Override
public double get999thPercentile() {
return histogram.getStatistics().getQuantile(0.999);
}
}
内容来源于网络,如有侵权,请联系作者删除!