mirror of https://github.com/apache/druid.git
Fix metrics for inserting segments (#5749)
* Fix metrics for inserting segments * Add a comment
This commit is contained in:
parent
aa23fe6386
commit
c9d645103b
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue