我已将Apache Storm配置为使用version 2将指标发送到Graphite服务器。它发送了我所有螺栓和喷口的count
参数。我想发送螺栓和喷口的通信之间的延迟,以及处理它们上的每个元组的时间。但是,我在Graphite服务器上找到的所有内容都是与螺栓和喷口上的count
元组相关的指标。文档说可以收集直方图,定时器等。但是没有解释如何收集它。
# Metrics v2 configuration (optional)
storm.metrics.reporters:
# Graphite Reporter
- class: "org.apache.storm.metrics2.reporters.GraphiteStormReporter"
daemons:
- "supervisor"
- "nimbus"
- "worker"
report.period: 30
report.period.units: "SECONDS"
graphite.host: "127.0.0.1"
graphite.port: 2003
我在所有Bolts上都包含了一个Meter
,现在它已经在Graphite Web服务器上显示了。
public class MqttSensorDetailSpout extends BaseRichSpout {
...
private Meter tupleMeter;
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
this.tupleMeter = context.registerMeter("meterSpout-" + this.topic);
}
public void nextTuple() {
this.tupleMeter.mark();
...
}
}