use of org.apache.storm.metrics2.PerReporterGauge in project storm by apache.
the class Executor method processGauges.
private void processGauges(int taskId, List<IMetricsConsumer.DataPoint> dataPoints) {
Map<String, Gauge> gauges = workerData.getMetricRegistry().getTaskGauges(taskId);
for (Map.Entry<String, Gauge> entry : gauges.entrySet()) {
Gauge gauge = entry.getValue();
Object v;
if (gauge instanceof PerReporterGauge) {
v = ((PerReporterGauge) gauge).getValueForReporter(this);
} else {
v = gauge.getValue();
}
if (v instanceof Number) {
IMetricsConsumer.DataPoint dataPoint = new IMetricsConsumer.DataPoint(entry.getKey(), v);
dataPoints.add(dataPoint);
}
}
}
Aggregations