Fix metrics for inserting segments (#5749)

* Fix metrics for inserting segments

* Add a comment
This commit is contained in:
Jihoon Son 2018-05-08 13:07:39 -07:00 committed by Jonathan Wei
parent aa23fe6386
commit c9d645103b
1 changed files with 12 additions and 13 deletions

View File

@ -125,21 +125,20 @@ public class SegmentTransactionalInsertAction implements TaskAction<SegmentPubli
throw new RuntimeException(e); throw new RuntimeException(e);
} }
// Emit metrics
final ServiceMetricEvent.Builder metricBuilder = new ServiceMetricEvent.Builder();
IndexTaskUtils.setTaskDimensions(metricBuilder, task);
if (retVal.isSuccess()) { if (retVal.isSuccess()) {
// Emit metrics toolbox.getEmitter().emit(metricBuilder.build("segment/txn/success", 1));
final ServiceMetricEvent.Builder metricBuilder = new ServiceMetricEvent.Builder(); } else {
IndexTaskUtils.setTaskDimensions(metricBuilder, task); toolbox.getEmitter().emit(metricBuilder.build("segment/txn/failure", 1));
}
if (retVal.isSuccess()) { // getSegments() should return an empty set if announceHistoricalSegments() failed
toolbox.getEmitter().emit(metricBuilder.build("segment/txn/success", 1)); for (DataSegment segment : retVal.getSegments()) {
} else { metricBuilder.setDimension(DruidMetrics.INTERVAL, segment.getInterval().toString());
toolbox.getEmitter().emit(metricBuilder.build("segment/txn/failure", 1)); toolbox.getEmitter().emit(metricBuilder.build("segment/added/bytes", segment.getSize()));
}
for (DataSegment segment : retVal.getSegments()) {
metricBuilder.setDimension(DruidMetrics.INTERVAL, segment.getInterval().toString());
toolbox.getEmitter().emit(metricBuilder.build("segment/added/bytes", segment.getSize()));
}
} }
return retVal; return retVal;