我有一个成功执行的shutdownhook,但未报告指标。任何建议表示赞赏!我想问题可能是
StatsDMetricWriter
可能会在关机挂钩之前处理?我该如何验证?或者有没有办法确保配置单例的排序?Thread.sleep(20000)
生成一个新的线程。但它不起作用代码段如下:
public class ShutDownHook implements DisposableBean {
@Autowired
private MetricRegistry registry;
@Override
public void destroy() throws Exception {
registry.counter("appName.deployments.count").dec();
//Spawned new thread here with high sleep with no effect
}
}
dropwizard的我的指标配置如下:
@Bean
@ExportMetricReader
public MetricRegistryMetricReader metricsDWMetricReader() {
return new MetricRegistryMetricReader(metricRegistry);
}
@Bean
@ExportMetricWriter
public MetricWriter metricWriter() {
return new StatsdMetricWriter(app, host, port);
}
报告时间延迟设置为1秒:
spring.metrics.export.delay-millis=1000
的修改:
问题如下:
DEBUG 10452 --- [pool-2-thread-1] o.s.b.a.m.statsd.StatsdMetricWriter : Failed to write metric. Exception: class java.util.concurrent.RejectedExecutionException, message: Task com.timgroup.statsd.NonBlockingUdpSender$2@1dd8867d rejected from java.util.concurrent.ThreadPoolExecutor
- 在关闭bean之前看起来ThreadPoolExecutor
已关闭。
有什么建议吗?
的修改
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller.getCommandJson()
包含以下代码
json.writeNumberField("reportingHosts", 1); // this will get summed across all instances in a cluster
我不确定这些数字会如何/为何会加起来?我在哪里可以找到那种逻辑?