title: How to use storm's New Metrics Reporting API?
body: <p>I use the storm V1.2.1. After setting up according to the official documentation, I want to get some metrics in the spout, the spout code is as follows, but there is no expected metric data in graphite-web.</p>
  
  <p><strong>Question 1</strong>：How to use the New Metrics Reporting API correctly？</p>
  
  <p><strong>Question 2</strong>：How do I get the ACK number metric in the storm-bound KafkaSpout by using Storm's Old or New Metrics API?</p>
  
  <p>Using New API in the spout to get the number of the tuple：</p>
  
  <pre><code>      public static class MyTestWordSpout extends BaseRichSpout {
              public static Logger LOG = LoggerFactory.getLogger(TestWordSpout.class);
              boolean _isDistributed;
              SpoutOutputCollector _collector;
              private Counter tupleCounter;
              transient CountMetric ackcountMetric;
              long msid=0;
  
  
              public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
                  _collector = collector;
                  this.tupleCounter = context.registerCounter("tupleCount");
                  ackcountMetric = new CountMetric();
                  context.registerMetric("ack_count", ackcountMetric, 5);
              }
  
              public void close() {
  
              }
  
              public void nextTuple() {
                  Utils.sleep(100);
                  final String[] words = new String[] {"nathan", "mike", "jackson", "golda", "bertels"};
                  final Random rand = new Random();
                  final String word = words[rand.nextInt(words.length)];
                  _collector.emit(new Values(word),msid++);
                  this.tupleCounter.inc();
  
              }
  
              public void ack(Object msgId) {
                    ackcountMetric.incr();
              }
  
              public void fail(Object msgId) {
  
              }
  
              public void declareOutputFields(OutputFieldsDeclarer declarer) {
                  declarer.declare(new Fields("word"));
              }
          }
  </code></pre>
  
  <p>storm.yaml：</p>
  
  <pre><code>storm.metrics.reporters:
    # Graphite Reporter
    - class: "org.apache.storm.metrics2.reporters.GraphiteStormReporter"
      daemons:
          - "supervisor"
          - "nimbus"
          - "worker"
      report.period: 1
      report.period.units: "SECONDS"
      graphite.host: "10.11.6.79"
      graphite.port: 2003
    - class: "org.apache.storm.metrics2.reporters.ConsoleStormReporter"
      daemons:
          - "worker"
      report.period: 1
      report.period.units: "SECONDS"
  </code></pre>
  
  <p>graphite browser:
  <a href="https://i.stack.imgur.com/vDZfu.png" rel="nofollow noreferrer">graphite browser</a></p>