下面列出了com.codahale.metrics.jvm.ThreadStatesGaugeSet#com.codahale.metrics.health.jvm.ThreadDeadlockHealthCheck 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@PostConstruct
public void init() {
/*
* consoleReporter = ConsoleReporter.forRegistry(metricRegistry) .convertRatesTo(TimeUnit.SECONDS)
* .convertDurationsTo(TimeUnit.MILLISECONDS) .build(); consoleReporter.start(1, TimeUnit.SECONDS);
*/
GarbageCollectorMetricSet gc = new GarbageCollectorMetricSet();
// FileDescriptorRatioGauge fd = new FileDescriptorRatioGauge();
MemoryUsageGaugeSet mu = new MemoryUsageGaugeSet();
// ThreadDeadlockDetector td = new ThreadDeadlockDetector();
// ThreadDump t = new ThreadDump();
ThreadStatesGaugeSet ts = new ThreadStatesGaugeSet();
metricRegistry.register("GarbageCollector", gc);
// registry.register(FileDescriptorRatioGauge.class.getName(), fd);
metricRegistry.register("MemoryUsage", mu);
// registry.register(ThreadDeadlockDetector.class.getName(), td);
// registry.registerAll(t);
metricRegistry.register("ThreadStates", ts);
healthCheckRegistry.register("threadDeadlock",
new ThreadDeadlockHealthCheck());
}
protected void initHealthChecks() {
this.healthChecks.register(
"healthcheck.filequeue",
new FilePickUpPlaceHealthCheck(this.conf.findIntEntry("MAX_FILE_COUNT_BEFORE_UNHEALTHY", Integer.MAX_VALUE), this.conf.findLongEntry(
"MAX_AGGREGATE_FIZE_SIZE_BEFORE_UNHEALTHY_BYTES", Long.MAX_VALUE)));
this.healthChecks.register("healthcheck.threaddeadlocks", new ThreadDeadlockHealthCheck());
}
/**
* Will initialize Moneta given a configuration. This <b>must</b> be executed before use.
* @param config XML configuration
*/
protected final void init(XMLConfiguration config) {
initDataSources(config);
initTopics(config);
healthChecks.put("Deadlock", new ThreadDeadlockHealthCheck());
initRun = true;
}
public RegisterJVMMetrics(CommandBuilder builder, Config config, Command parent,
Command child, final MorphlineContext context) {
super(builder, config, parent, child, context);
validateArguments();
MetricRegistry registry = context.getMetricRegistry();
BufferPoolMetricSet bufferPoolMetrics = new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer());
registerAll("jvm.buffers", bufferPoolMetrics, registry);
registerAll("jvm.gc", new GarbageCollectorMetricSet(), registry);
registerAll("jvm.memory", new MemoryUsageGaugeSet(), registry);
registerAll("jvm.threads", new ThreadStatesGaugeSet(), registry);
register("jvm.fileDescriptorCountRatio", new FileDescriptorRatioGauge(), registry);
context.getHealthCheckRegistry().register("deadlocks", new ThreadDeadlockHealthCheck());
}
@Autowired
public void setHealthCheckRegistry(HealthCheckRegistry registry) {
registry.register(ThreadDeadlockHealthCheck.class.getName(), new ThreadDeadlockHealthCheck());
}
public HealthCheck get() {
return new ThreadDeadlockHealthCheck();
}