Skip to content

Commit

Permalink
fix: modify mdcTracer
Browse files Browse the repository at this point in the history
  • Loading branch information
rchen9 committed Jul 18, 2024
1 parent d470d0e commit 062678e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.arextest.common.model.response.GenericResponseType;
import com.arextest.schedule.client.HttpWepServiceApiClient;
import com.arextest.schedule.common.JsonUtils;
import com.arextest.schedule.mdc.MDCTracer;
import com.arextest.schedule.model.ReplayActionItem;
import com.arextest.schedule.model.ReplayPlan;
import com.arextest.schedule.model.config.ComparisonInterfaceConfig;
Expand Down Expand Up @@ -110,6 +111,8 @@ public void preload(ReplayPlan plan) {
if (actionItem.getReplayCaseCount() == 0) {
continue;
}

MDCTracer.addPlanItemId(actionItem.getId());
String operationId = actionItem.getOperationId();

ReplayComparisonConfig config = operationCompareConfig.getOrDefault(operationId,
Expand All @@ -125,6 +128,7 @@ public void preload(ReplayPlan plan) {

LOGGER.info("prepare load compare config, action id:{}, config:{}", actionItem.getId(),
configValue);
MDCTracer.removePlanItemId();
}
progressEvent.onCompareConfigLoaded(plan);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,13 @@ public static void addPlanItemId(String planItemId) {
MDC.put(PLAN_ITEM_ID, planItemId);
}

public static void addPlanId(long planId) {
addAppType();
add(PLAN_ID, planId);
}

public static void addActionId(String actionId) {
addAppType();
MDC.put(PLAN_ID, actionId);
public static void removePlanItemId() {
MDC.remove(PLAN_ITEM_ID);
}

public static void addActionId(long actionId) {
public static void addPlanId(long planId) {
addAppType();
add(ACTION_ID, actionId);
add(PLAN_ID, planId);
}

public static void addDetailId(String detailId) {
Expand Down

0 comments on commit 062678e

Please sign in to comment.