docs: private void collectThreadStats(final StatsCollector collector) {
      final Set<Thread> threads = Thread.getAllStackTraces().keySet();
      final Map<String, Integer> states = new HashMap<String, Integer>(6);
      states.put("new", 0);
      states.put("runnable", 0);
      states.put("blocked", 0);
      states.put("waiting", 0);
      states.put("timed_waiting", 0);
      states.put("terminated", 0);
      for (final Thread thread : threads) {
        int state_count = states.get(thread.getState().toString().toLowerCase());
        state_count++;
        states.put(thread.getState().toString().toLowerCase(), state_count);
      }
      for (final Map.Entry<String, Integer> entry : states.entrySet()) {
        collector.record("jvm.thread.states", entry.getValue(), "state=" + 
            entry.getKey());
      }
      collector.record("jvm.thread.count", threads.size());
    }