Skip to content

Commit

Permalink
chore: log content (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
QizhengMo authored Nov 2, 2023
1 parent f1c43b7 commit 04b3adf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public static void recordContextProcessedNormal(PlanExecutionContext<?> context,

public static void recordContextPrepareFailure(PlanExecutionContext<?> context, Throwable t) {
BizLog log = BizLog.error().logType(BizLogContent.CONTEXT_PREPARE_ERR.getType())
.message(BizLogContent.CONTEXT_PREPARE_ERR.format(context.getContextName()))
.message(BizLogContent.CONTEXT_PREPARE_ERR.format(context.getContextName(), t.getMessage()))
.exception(BizLogContent.throwableToString(t)).build();

log.postProcessAndEnqueue(context);
Expand Down Expand Up @@ -227,7 +227,7 @@ public enum BizLogContent {
CONTEXT_AFTER_RUN(202, "Context: {0} done, after hook took {1} ms."),
CONTEXT_SKIP(203, "Context: {0}, Action: {1}, skipped {2} cases "),
CONTEXT_NORMAL(204, "Context: {0}, execute normal, {1} cases sent."),
CONTEXT_PREPARE_ERR(205, "Context: {0}, prepare remote dependency failed."),
CONTEXT_PREPARE_ERR(205, "Context: {0}, prepare remote dependency failed due to {1}."),

ACTION_ITEM_CASE_SAVED(306, "Operation {0} saved total {1} cases to send, took {2} ms."),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ public void onBeforeContextExecution(
// todo: multi-instance should be supported here
boolean caseSuccess = sender.send(warmupCase, warmupHeader);
if (!caseSuccess) {
if (StringUtils.isEmpty(plan.getErrorMessage())) {
plan.setErrorMessage(warmupCase.getSendErrorMessage());
}
throw new RuntimeException(
"Failed to warmup context: " + currentContext + " with case:" + warmupCase);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private void finalizePlanStatus(ReplayPlan replayPlan) {
} else if (executionStatus.isInterrupted()) {
progressEvent.onReplayPlanInterrupt(replayPlan, ReplayStatusType.FAIL_INTERRUPTED);
BizLogger.recordPlanStatusChange(replayPlan, ReplayStatusType.FAIL_INTERRUPTED.name(),
"Plan Interrupted by QPS limiter.");
"Plan Interrupted because there are 40+ continuous failure or more than 10% of cases failed.");
} else if (replayPlan.getCaseTotalCount() == 0) {
progressEvent.onReplayPlanFinish(replayPlan);
BizLogger.recordPlanStatusChange(replayPlan, ReplayStatusType.FINISHED.name(),
Expand Down

0 comments on commit 04b3adf

Please sign in to comment.