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); } }
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()); } }
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); }