class ThreadStatesGaugeSet implements MetricSet {

    @Override
    public Map<String, Metric> getMetrics() {
        final Map<String, Metric> gauges = new HashMap<>();

        for (final Thread.State state : Thread.State.values()) {
            gauges.put(name(state.toString().toLowerCase(), "count"),
                    (Gauge<Object>) () -> getThreadCount(state));
        }

        gauges.put("count", (Gauge<Integer>) threads::getThreadCount);
        gauges.put("daemon.count", (Gauge<Integer>) threads::getDaemonThreadCount);
        gauges.put("peak.count", (Gauge<Integer>) threads::getPeakThreadCount);
        gauges.put("total_started.count", (Gauge<Long>) threads::getTotalStartedThreadCount);
        gauges.put("deadlock.count", (Gauge<Integer>) () -> deadlockDetector.getDeadlockedThreads().size());
        gauges.put("deadlocks", (Gauge<Set<String>>) deadlockDetector::getDeadlockedThreads);

        return Collections.unmodifiableMap(gauges);
    }

    public  ThreadStatesGaugeSet();
    public  ThreadStatesGaugeSet(ThreadMXBean threads,
                                ThreadDeadlockDetector deadlockDetector);

}