Java 类com.codahale.metrics.jvm.CachedThreadStatesGaugeSet 实例源码

项目:JInsight    文件:JvmMetricSet.java   
public JvmMetricSet() {
  registerSet("jvm.buffers", new BufferPoolMetricSet(getPlatformMBeanServer()));
  registerSet("jvm.classloading", new ClassLoadingGaugeSet());
  registerSet("jvm.fd", new FileDescriptorMetrics());
  registerSet("jvm.gc", new GarbageCollectorMetricSet());
  registerSet("jvm.memory", new MemoryUsageGaugeSet());
  registerSet("jvm.thread", new CachedThreadStatesGaugeSet(60, TimeUnit.SECONDS));

  metrics.put("jvm.uptime", new UptimeGauge());

  try {
    metrics.put("jvm.processCPU", new ProcessCpuTicksGauge());
  } catch (ClassNotFoundException | IOException e) {
    LOGGER.error("Error fetching process CPU usage metrics.", e);
  }
}
项目:metrics-agent    文件:DropwizardMetricSystem.java   
private void addJVMMetrics(Map<String, Object> configuration) {
    if (!configuration.containsKey("jvm")) {
        return;
    }
    Set<String> jvmMetrics = new HashSet<String>((List<String>)configuration.get("jvm"));
    if (jvmMetrics.contains("gc")) {
        registry.register("gc", new GarbageCollectorMetricSet());
    }

    if (jvmMetrics.contains("threads")) {
        registry.register("threads", new CachedThreadStatesGaugeSet(10, TimeUnit.SECONDS));
    }

    if (jvmMetrics.contains("memory")) {
        registry.register("memory", new MemoryUsageGaugeSet());
    }

    if (jvmMetrics.contains("classloader")) {
        registry.register("memory", new ClassLoadingGaugeSet());
    }
}
项目:grakn    文件:GraknCreator.java   
private static TaskManager taskManager(GraknConfig config, EngineGraknTxFactory factory, Pool<Jedis> jedisPool, EngineID engineId, MetricRegistry metricRegistry, PostProcessor postProcessor) {
    metricRegistry.register(name(GraknEngineServer.class, "jedis", "idle"), (Gauge<Integer>) jedisPool::getNumIdle);
    metricRegistry.register(name(GraknEngineServer.class, "jedis", "active"), (Gauge<Integer>) jedisPool::getNumActive);
    metricRegistry.register(name(GraknEngineServer.class, "jedis", "waiters"), (Gauge<Integer>) jedisPool::getNumWaiters);
    metricRegistry.register(name(GraknEngineServer.class, "jedis", "borrow_wait_time_ms", "max"), (Gauge<Long>) jedisPool::getMaxBorrowWaitTimeMillis);
    metricRegistry.register(name(GraknEngineServer.class, "jedis", "borrow_wait_time_ms", "mean"), (Gauge<Long>) jedisPool::getMeanBorrowWaitTimeMillis);

    metricRegistry.register(name(GraknEngineServer.class, "System", "gc"), new GarbageCollectorMetricSet());
    metricRegistry.register(name(GraknEngineServer.class, "System", "threads"), new CachedThreadStatesGaugeSet(15, TimeUnit.SECONDS));
    metricRegistry.register(name(GraknEngineServer.class, "System", "memory"), new MemoryUsageGaugeSet());

    int consumers = config.getProperty(GraknConfigKey.QUEUE_CONSUMERS);
    return new RedisTaskManager(engineId, config, jedisPool, consumers, factory, metricRegistry, postProcessor);
}