Search code examples
apache-stormgraphite

How to send latency metrics from Apache Storm to a Graphite server?


I have configured Apache Storm to send metrics to Graphite server using the version 2. It is sending a count parameter of all my bolts and spouts. I would like to send the latency between the communication of the bolts and spouts, and the time to process each tuple on them as well. However, everything that I find on the Graphite server is metrics related to count tuples on bolts and spouts. The documentation says it is possible to collect Histograms, Timers, etc. But does not explain how it is possible to collect it.

# 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

enter image description here


Solution

  • I have included a Meter on all Bolts and now it is showing on the Graphite web server.

    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();
            ...
        }
    }
    

    enter image description here