You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ConsoleReporter consoleReporter = new ConsoleReporter();
Slf4jReporter slf4jReporter = new Slf4jReporter();
scheduler = new ReportScheduler(MetricRegistry.INSTANCE,
consoleReporter);
if (graphiteEnabled) {
GraphiteReporter graphiteReporter = new GraphiteReporter(
new InetSocketAddress("localhost", 2003));
scheduler.addReporter(graphiteReporter);
}
scheduler.addReporter(slf4jReporter);
scheduler.start(10, TimeUnit.SECONDS);
错误再现
将showcase的MetricsManager类作如下修改
ConsoleReporter consoleReporter = new ConsoleReporter();
Slf4jReporter slf4jReporter = new Slf4jReporter();
scheduler = new ReportScheduler(MetricRegistry.INSTANCE,
consoleReporter);
添加了一个slf4jReport,运行即报错。
解决办法
1、添加依赖
2、将metrics项目的ReportScheduler的构造函数
public ReportScheduler(MetricRegistry metricRegistry, Reporter... reporters) {
this(metricRegistry, Arrays.asList(reporters));
}
修改为
public ReportScheduler(MetricRegistry metricRegistry, Reporter... reporters) {
this(metricRegistry, Lists.newArrayList(reporters));
}
即可
The text was updated successfully, but these errors were encountered: