@Override
  public void getMetrics(MetricsCollector collector, boolean all) {
    // We could also have one metricssource for all the pools and add all the pools to the collector
    // in its getMetrics call (as separate records). Not clear if that's supported.
    // Also, we'd have to initialize the metrics ourselves instead of using @Metric annotation.
    MetricsRecordBuilder rb = collector.addRecord("WmPoolMetrics." + poolName)
        .setContext("HS2").tag(MsInfo.SessionId, poolName);
    if (allMetrics == null) {
      initAfterRegister(); // This happens if register calls getMetrics.
    }
    for (MutableMetric metric : allMetrics.values()) {
      metric.snapshot(rb, all);
    }
  }
A wrapper for metrics for single WM pool. This outputs metrics both to Codahale and standard
Hadoop metrics, in parallel. The codahale output is prefixed with pool name and is mostly
for the JMX view, or to look at when Hadoop metrics are not set up. Hadoop metrics are output
because they can be tagged properly rather than prefixed, so they are better for dashboards.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/WmPoolMetrics.java