From bc5f80b72f50853be8a6c6637670b78228196fd5 Mon Sep 17 00:00:00 2001 From: qzmo Date: Thu, 2 Nov 2023 15:47:27 +0800 Subject: [PATCH] chore: log content --- .../src/main/java/com/arextest/schedule/bizlog/BizLogger.java | 4 ++-- .../planexecution/impl/DefaultExecutionContextProvider.java | 3 +++ .../com/arextest/schedule/service/PlanConsumeService.java | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arex-schedule-web-api/src/main/java/com/arextest/schedule/bizlog/BizLogger.java b/arex-schedule-web-api/src/main/java/com/arextest/schedule/bizlog/BizLogger.java index 5aad3eb9..fe7f36bb 100644 --- a/arex-schedule-web-api/src/main/java/com/arextest/schedule/bizlog/BizLogger.java +++ b/arex-schedule-web-api/src/main/java/com/arextest/schedule/bizlog/BizLogger.java @@ -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); @@ -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."), diff --git a/arex-schedule-web-api/src/main/java/com/arextest/schedule/planexecution/impl/DefaultExecutionContextProvider.java b/arex-schedule-web-api/src/main/java/com/arextest/schedule/planexecution/impl/DefaultExecutionContextProvider.java index 2fba47de..7d7d7201 100644 --- a/arex-schedule-web-api/src/main/java/com/arextest/schedule/planexecution/impl/DefaultExecutionContextProvider.java +++ b/arex-schedule-web-api/src/main/java/com/arextest/schedule/planexecution/impl/DefaultExecutionContextProvider.java @@ -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); } diff --git a/arex-schedule-web-api/src/main/java/com/arextest/schedule/service/PlanConsumeService.java b/arex-schedule-web-api/src/main/java/com/arextest/schedule/service/PlanConsumeService.java index 2e4f5f54..c67d8a63 100644 --- a/arex-schedule-web-api/src/main/java/com/arextest/schedule/service/PlanConsumeService.java +++ b/arex-schedule-web-api/src/main/java/com/arextest/schedule/service/PlanConsumeService.java @@ -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(),