Merge branch 'master' of github.com:metamx/druid into query-resource

This commit is contained in:
fjy 2013-11-20 10:02:51 -08:00
commit c60e75a6b4
1 changed files with 11 additions and 0 deletions

View File

@ -47,9 +47,14 @@ public class ServerMonitor extends AbstractMonitor
public boolean doMonitor(ServiceEmitter emitter)
{
emitter.emit(new ServiceMetricEvent.Builder().build("server/segment/max", serverConfig.getMaxSize()));
long totalUsed = 0;
long totalCount = 0;
for (Map.Entry<String, Long> entry : serverManager.getDataSourceSizes().entrySet()) {
String dataSource = entry.getKey();
long used = entry.getValue();
totalUsed += used;
final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder().setUser1(dataSource)
.setUser2(serverConfig.getTier());
@ -60,12 +65,18 @@ public class ServerMonitor extends AbstractMonitor
for (Map.Entry<String, Long> entry : serverManager.getDataSourceCounts().entrySet()) {
String dataSource = entry.getKey();
long count = entry.getValue();
totalCount += count;
final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder().setUser1(dataSource)
.setUser2(serverConfig.getTier());
emitter.emit(builder.build("server/segment/count", count));
}
final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder().setUser2(serverConfig.getTier());
emitter.emit(builder.build("server/segment/totalUsed", totalUsed));
emitter.emit(builder.build("server/segment/totalUsedPercent", totalUsed / (double) serverConfig.getMaxSize()));
emitter.emit(builder.build("server/segment/totalCount", totalCount));
return true;
}
}