-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HUDI-6313] Add metrics counters for compaction requested/completed events. #8759
Changes from 2 commits
953795e
fbdd1d2
f926796
eb78efa
c8b0280
155e496
eab8998
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,11 +35,15 @@ | |
import org.apache.hudi.config.HoodieWriteConfig; | ||
import org.apache.hudi.exception.HoodieCompactionException; | ||
import org.apache.hudi.internal.schema.utils.SerDeHelper; | ||
import org.apache.hudi.metrics.HoodieMetrics; | ||
import org.apache.hudi.table.HoodieCompactionHandler; | ||
import org.apache.hudi.table.HoodieTable; | ||
import org.apache.hudi.table.action.BaseActionExecutor; | ||
import org.apache.hudi.table.action.HoodieWriteMetadata; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.util.List; | ||
|
||
import static org.apache.hudi.common.util.ValidationUtils.checkArgument; | ||
|
@@ -48,10 +52,14 @@ | |
public class RunCompactionActionExecutor<T> extends | ||
BaseActionExecutor<T, HoodieData<HoodieRecord<T>>, HoodieData<HoodieKey>, HoodieData<WriteStatus>, HoodieWriteMetadata<HoodieData<WriteStatus>>> { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(LogCompactionExecutionHelper.class); | ||
|
||
private final HoodieCompactor compactor; | ||
private final HoodieCompactionHandler compactionHandler; | ||
private WriteOperationType operationType; | ||
|
||
private final HoodieMetrics metrics; | ||
|
||
public RunCompactionActionExecutor(HoodieEngineContext context, | ||
HoodieWriteConfig config, | ||
HoodieTable table, | ||
|
@@ -65,10 +73,14 @@ public RunCompactionActionExecutor(HoodieEngineContext context, | |
this.operationType = operationType; | ||
checkArgument(operationType == WriteOperationType.COMPACT || operationType == WriteOperationType.LOG_COMPACT, | ||
"Only COMPACT and LOG_COMPACT is supported"); | ||
metrics = new HoodieMetrics(config); | ||
} | ||
|
||
@Override | ||
public HoodieWriteMetadata<HoodieData<WriteStatus>> execute() { | ||
LOG.info("Compaction start."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need this. or you added for debugging purpose? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nsivabalan I added this based on our last discussion. It should help to get an idea of individual start / stop compaction events. |
||
metrics.emitCompactionStart(); | ||
|
||
HoodieTimeline pendingMajorOrMinorCompactionTimeline = WriteOperationType.COMPACT.equals(operationType) | ||
? table.getActiveTimeline().filterPendingCompactionTimeline() | ||
: table.getActiveTimeline().filterPendingLogCompactionTimeline(); | ||
|
@@ -116,6 +128,8 @@ public HoodieWriteMetadata<HoodieData<WriteStatus>> execute() { | |
throw new HoodieCompactionException("Could not compact " + config.getBasePath(), e); | ||
} | ||
|
||
LOG.info("Compaction stop."); | ||
metrics.emitCompactionStop(); | ||
return compactionMetadata; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RunCompactionActionExecutor.class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.