我已经配置了dropwizard(codehale)指标注册表中的一个基本sl4j记者。这是记者的配置:
Slf4jReporter.forRegistry(metricRegistry)
.outputTo(slf4jLogger)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.build();
reporter.start(30, TimeUnit.SECONDS);
我收到的日志是不是我所期待的(预期定时器的解析的输出,wtih metricRegistry注册计数器)。这就是我真正看到每30秒(这符合记者的配置):
....的java:55)org.slf4j.helpers.FormattingTuple@39fda09e
反正有获得在日志中codahale指标(定时器,计数器等)的有用的代表性?
我的答案是不相关的问这个问题。请参阅下面的注释。
Dropwizard集成功能报告指标数据。他们被称为reporters
。您需要添加额外的配置指令。例如用于SLF4J reporter:
metrics:
reporters:
- type: log
logger: metrics
markerName: <marker name>
这里检查手册:https://www.dropwizard.io/1.3.8/docs/manual/configuration.html#metrics