From a50131532e47fd3eb6917df859591ce004bc89b5 Mon Sep 17 00:00:00 2001 From: wangyu096 Date: Sat, 7 Oct 2023 16:25:44 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20Job=20=E5=88=87=E6=8D=A2=20GSE2.0=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=81=B0=E5=BA=A6=E7=AD=96=E7=95=A5=20#2461?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/common-service/build.gradle | 1 + .../feature/FeatureLoadApplicationRunner.java | 54 +++++++++++++++++++ .../service/feature/InMemoryFeatureStore.java | 52 +++++++++--------- .../feature/{ => config}/FeatureConfig.java | 2 +- .../{ => config}/FeatureToggleConfig.java | 2 +- .../{ => config}/ToggleStrategyConfig.java | 8 +-- .../AbstractResourceScopeToggleStrategy.java | 4 +- .../strategy/AbstractToggleStrategy.java | 22 ++++---- .../strategy/AllMatchToggleStrategy.java | 5 +- .../strategy/AnyMatchToggleStrategy.java | 5 +- .../JobInstanceAttrToggleStrategy.java | 5 +- .../ResourceScopeBlackListToggleStrategy.java | 4 +- .../ResourceScopeWhiteListToggleStrategy.java | 4 +- .../strategy/WeightToggleStrategy.java | 4 +- .../src/test/java}/FeatureToggleTest.java | 27 ++++++---- .../src/test/resources/features_1.yaml | 12 ++--- .../AppResourceScopeInterceptor.java | 4 +- src/backend/commons/common/build.gradle | 1 - .../bk/job/common/util/feature/Feature.java | 2 - .../util}/feature/FeatureIdConstants.java | 2 +- .../common/util/feature/FeatureToggle.java | 7 --- .../common/util/feature/ToggleStrategy.java | 9 +--- src/backend/gradle.properties | 2 +- .../analysis/JobAnalysisBootApplication.java | 2 +- .../assemble/JobAssembleBootApplication.java | 2 +- .../job/backup/JobBackupBootApplication.java | 2 +- .../crontab/JobCrontabBootApplication.java | 2 +- .../execute/JobExecuteBootApplication.java | 2 +- .../engine/result/FileResultHandleTask.java | 9 ++-- .../service/impl/TaskExecuteServiceImpl.java | 9 ++-- .../JobFileGatewayBootApplication.java | 2 +- .../gateway/JobGatewayBootApplication.java | 2 +- .../bk/job/logsvr/JobLogBootApplication.java | 2 +- .../job/manage/JobManageBootApplication.java | 2 +- .../impl/GlobalSettingsServiceImpl.java | 4 +- 35 files changed, 161 insertions(+), 117 deletions(-) create mode 100644 src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/FeatureLoadApplicationRunner.java rename src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/{ => config}/FeatureConfig.java (96%) rename src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/{ => config}/FeatureToggleConfig.java (97%) rename src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/{ => config}/ToggleStrategyConfig.java (92%) rename src/backend/commons/{common/src/test/java/com/tencent/bk/job/common/util/feature => common-service/src/test/java}/FeatureToggleTest.java (84%) rename src/backend/commons/{common => common-service}/src/test/resources/features_1.yaml (54%) rename src/backend/commons/{common-service/src/main/java/com/tencent/bk/job/common/service => common/src/main/java/com/tencent/bk/job/common/util}/feature/FeatureIdConstants.java (97%) diff --git a/src/backend/commons/common-service/build.gradle b/src/backend/commons/common-service/build.gradle index 5bdcba5306..642ea6c8b8 100644 --- a/src/backend/commons/common-service/build.gradle +++ b/src/backend/commons/common-service/build.gradle @@ -54,4 +54,5 @@ dependencies { api 'io.prometheus:simpleclient_pushgateway' api 'io.micrometer:micrometer-registry-prometheus' testImplementation 'org.springframework.boot:spring-boot-starter-test' + testImplementation 'org.mockito:mockito-inline' } diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/FeatureLoadApplicationRunner.java b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/FeatureLoadApplicationRunner.java new file mode 100644 index 0000000000..aa004ad6c1 --- /dev/null +++ b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/FeatureLoadApplicationRunner.java @@ -0,0 +1,54 @@ +/* + * Tencent is pleased to support the open source community by making BK-JOB蓝鲸智云作业平台 available. + * + * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. + * + * BK-JOB蓝鲸智云作业平台 is licensed under the MIT License. + * + * License for BK-JOB蓝鲸智云作业平台: + * -------------------------------------------------------------------- + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and + * to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of + * the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO + * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +package com.tencent.bk.job.common.service.feature; + +import com.tencent.bk.job.common.util.feature.FeatureStore; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.stereotype.Component; + +/** + * 特性开关配置加载 ApplicationRunner + */ +@Component +@Slf4j +public class FeatureLoadApplicationRunner implements ApplicationRunner { + private final FeatureStore featureStore; + + @Autowired + public FeatureLoadApplicationRunner(FeatureStore featureStore) { + this.featureStore = featureStore; + } + + @Override + public void run(ApplicationArguments args) throws Exception { + // 初始化特性开关配置;如果初始化错误,那么抛出异常终止程序启动 + log.info("FeatureLoadApplicationRunner start"); + featureStore.load(false); + log.info("FeatureLoadApplicationRunner run success"); + } +} diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/InMemoryFeatureStore.java b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/InMemoryFeatureStore.java index 982eb72b9c..989a7543ba 100644 --- a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/InMemoryFeatureStore.java +++ b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/InMemoryFeatureStore.java @@ -24,6 +24,9 @@ package com.tencent.bk.job.common.service.feature; +import com.tencent.bk.job.common.service.feature.config.FeatureConfig; +import com.tencent.bk.job.common.service.feature.config.FeatureToggleConfig; +import com.tencent.bk.job.common.service.feature.config.ToggleStrategyConfig; import com.tencent.bk.job.common.service.feature.strategy.AllMatchToggleStrategy; import com.tencent.bk.job.common.service.feature.strategy.AnyMatchToggleStrategy; import com.tencent.bk.job.common.service.feature.strategy.FeatureConfigParseException; @@ -37,7 +40,7 @@ import com.tencent.bk.job.common.util.feature.ToggleStrategy; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.slf4j.helpers.MessageFormatter; +import org.springframework.stereotype.Component; import java.util.HashMap; import java.util.Map; @@ -47,6 +50,7 @@ * 特性开关配置存储实现 */ @Slf4j +@Component public class InMemoryFeatureStore implements FeatureStore { /** @@ -63,7 +67,7 @@ public Feature getFeature(String featureId) { if (!isInitial) { synchronized (this) { if (!isInitial) { - load(false); + load(true); } } } @@ -72,6 +76,19 @@ public Feature getFeature(String featureId) { @Override public void load(boolean ignoreException) { + try { + loadInternal(); + } catch (Throwable e) { + log.warn("Load feature config error", e); + if (ignoreException) { + log.warn("Ignore feature config load error"); + } else { + throw e; + } + } + } + + private void loadInternal() { synchronized (this) { log.info("Load feature toggle start ..."); FeatureToggleConfig featureToggleConfig = ApplicationContextRegister.getBean(FeatureToggleConfig.class); @@ -83,19 +100,8 @@ public void load(boolean ignoreException) { Map tmpFeatures = new HashMap<>(); featureToggleConfig.getFeatures().forEach((featureId, featureConfig) -> { - try { - Feature feature = parseFeatureConfig(featureId, featureConfig); - tmpFeatures.put(featureId, feature); - } catch (Throwable e) { - String msg = MessageFormatter.format( - "Load feature toggle config fail, skip update feature toggle config! featureId: {}, " + - "featureConfig: {}", featureId, featureConfig).getMessage(); - log.error(msg, e); - if (features.get(featureId) != null) { - // 如果加载失败,那么使用原有的特性配置 - tmpFeatures.put(featureId, features.get(featureId)); - } - } + Feature feature = parseFeatureConfig(featureId, featureConfig); + tmpFeatures.put(featureId, feature); }); // 使用新的配置完全替换老的配置 @@ -132,24 +138,19 @@ private ToggleStrategy parseToggleStrategy(ToggleStrategyConfig strategyConfig) ToggleStrategy toggleStrategy; switch (strategyId) { case ResourceScopeWhiteListToggleStrategy.STRATEGY_ID: - toggleStrategy = new ResourceScopeWhiteListToggleStrategy(strategyConfig.getDescription(), - strategyConfig.getParams()); + toggleStrategy = new ResourceScopeWhiteListToggleStrategy(strategyConfig.getParams()); break; case ResourceScopeBlackListToggleStrategy.STRATEGY_ID: - toggleStrategy = new ResourceScopeBlackListToggleStrategy(strategyConfig.getDescription(), - strategyConfig.getParams()); + toggleStrategy = new ResourceScopeBlackListToggleStrategy(strategyConfig.getParams()); break; case WeightToggleStrategy.STRATEGY_ID: - toggleStrategy = new WeightToggleStrategy(strategyConfig.getDescription(), - strategyConfig.getParams()); + toggleStrategy = new WeightToggleStrategy(strategyConfig.getParams()); break; case JobInstanceAttrToggleStrategy.STRATEGY_ID: - toggleStrategy = new JobInstanceAttrToggleStrategy(strategyConfig.getDescription(), - strategyConfig.getParams()); + toggleStrategy = new JobInstanceAttrToggleStrategy(strategyConfig.getParams()); break; case AllMatchToggleStrategy.STRATEGY_ID: toggleStrategy = new AllMatchToggleStrategy( - strategyId, strategyConfig.getStrategies() .stream() .map(this::parseToggleStrategy) @@ -158,7 +159,6 @@ private ToggleStrategy parseToggleStrategy(ToggleStrategyConfig strategyConfig) break; case AnyMatchToggleStrategy.STRATEGY_ID: toggleStrategy = new AnyMatchToggleStrategy( - strategyId, strategyConfig.getStrategies() .stream() .map(this::parseToggleStrategy) @@ -166,7 +166,7 @@ private ToggleStrategy parseToggleStrategy(ToggleStrategyConfig strategyConfig) strategyConfig.getParams()); break; default: - log.error("Unsupported toggle strategy: {} , ignore it!", strategyId); + log.error("Unsupported toggle strategy: {}", strategyId); throw new FeatureConfigParseException("Unsupported toggle strategy " + strategyId); } return toggleStrategy; diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/FeatureConfig.java b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/config/FeatureConfig.java similarity index 96% rename from src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/FeatureConfig.java rename to src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/config/FeatureConfig.java index 322b8ef86f..88d0bd4a3b 100644 --- a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/FeatureConfig.java +++ b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/config/FeatureConfig.java @@ -22,7 +22,7 @@ * IN THE SOFTWARE. */ -package com.tencent.bk.job.common.service.feature; +package com.tencent.bk.job.common.service.feature.config; import lombok.Data; diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/FeatureToggleConfig.java b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/config/FeatureToggleConfig.java similarity index 97% rename from src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/FeatureToggleConfig.java rename to src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/config/FeatureToggleConfig.java index 4bed0319a9..268126a01f 100644 --- a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/FeatureToggleConfig.java +++ b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/config/FeatureToggleConfig.java @@ -22,7 +22,7 @@ * IN THE SOFTWARE. */ -package com.tencent.bk.job.common.service.feature; +package com.tencent.bk.job.common.service.feature.config; import com.tencent.bk.job.common.util.json.JsonUtils; import lombok.Getter; diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/ToggleStrategyConfig.java b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/config/ToggleStrategyConfig.java similarity index 92% rename from src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/ToggleStrategyConfig.java rename to src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/config/ToggleStrategyConfig.java index 10caec2643..d27917605e 100644 --- a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/ToggleStrategyConfig.java +++ b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/config/ToggleStrategyConfig.java @@ -22,7 +22,7 @@ * IN THE SOFTWARE. */ -package com.tencent.bk.job.common.service.feature; +package com.tencent.bk.job.common.service.feature.config; import lombok.Data; @@ -39,11 +39,7 @@ public class ToggleStrategyConfig { */ private String id; /** - * 策略说明 - */ - private String description; - /** - * 组合策略 + * 组合策略配置 */ private List strategies; diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AbstractResourceScopeToggleStrategy.java b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AbstractResourceScopeToggleStrategy.java index 0b22f7e76d..3be0beff7e 100644 --- a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AbstractResourceScopeToggleStrategy.java +++ b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AbstractResourceScopeToggleStrategy.java @@ -46,8 +46,8 @@ public abstract class AbstractResourceScopeToggleStrategy extends AbstractToggle protected final Set resourceScopes = new HashSet<>(); - public AbstractResourceScopeToggleStrategy(String strategyId, String description, Map initParams) { - super(strategyId, description, null, initParams); + public AbstractResourceScopeToggleStrategy(String strategyId, Map initParams) { + super(strategyId, null, initParams); assertRequiredInitParam(INIT_PARAM_RESOURCE_SCOPE_LIST); String resourceScopesValue = initParams.get(INIT_PARAM_RESOURCE_SCOPE_LIST); diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AbstractToggleStrategy.java b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AbstractToggleStrategy.java index 985ad2863a..b2e6627407 100644 --- a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AbstractToggleStrategy.java +++ b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AbstractToggleStrategy.java @@ -40,25 +40,30 @@ @Slf4j public abstract class AbstractToggleStrategy implements ToggleStrategy { + /** + * 策略 ID + */ protected final String id; - protected final String description; + /** + * 组合策略 + */ protected List compositeStrategies = null; + /** + * 策略初始化参数 + */ protected final Map initParams; /** * 初始化特性开关 * * @param strategyId 策略ID - * @param description 策略说明 - * @param compositeStrategies 子策略 + * @param compositeStrategies 组合策略 * @param initParams 初始化参数 */ public AbstractToggleStrategy(String strategyId, - String description, List compositeStrategies, Map initParams) { this.id = strategyId; - this.description = description; this.compositeStrategies = compositeStrategies; if (initParams != null) { this.initParams = initParams; @@ -70,15 +75,12 @@ public AbstractToggleStrategy(String strategyId, /** * 初始化特性开关 * - * @param strategyId 策略ID - * @param description 策略说明 - * @param initParams 初始化参数 + * @param strategyId 策略ID + * @param initParams 初始化参数 */ public AbstractToggleStrategy(String strategyId, - String description, Map initParams) { this.id = strategyId; - this.description = description; if (initParams != null) { this.initParams = initParams; } else { diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AllMatchToggleStrategy.java b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AllMatchToggleStrategy.java index 95118716ce..0d808caad5 100644 --- a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AllMatchToggleStrategy.java +++ b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AllMatchToggleStrategy.java @@ -36,10 +36,9 @@ public class AllMatchToggleStrategy extends AbstractToggleStrategy { */ public static final String STRATEGY_ID = "AllMatchToggleStrategy"; - public AllMatchToggleStrategy(String description, - List strategies, + public AllMatchToggleStrategy(List strategies, Map initParams) { - super(STRATEGY_ID, description, strategies, initParams); + super(STRATEGY_ID, strategies, initParams); assertRequiredAtLeastOneStrategy(); } diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AnyMatchToggleStrategy.java b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AnyMatchToggleStrategy.java index a9bedc5386..d63a29d8ef 100644 --- a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AnyMatchToggleStrategy.java +++ b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/AnyMatchToggleStrategy.java @@ -37,10 +37,9 @@ public class AnyMatchToggleStrategy extends AbstractToggleStrategy { */ public static final String STRATEGY_ID = "AnyMatchToggleStrategy"; - public AnyMatchToggleStrategy(String description, - List strategies, + public AnyMatchToggleStrategy(List strategies, Map initParams) { - super(STRATEGY_ID, description, strategies, initParams); + super(STRATEGY_ID, strategies, initParams); assertRequiredAtLeastOneStrategy(); } diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/JobInstanceAttrToggleStrategy.java b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/JobInstanceAttrToggleStrategy.java index d264def1a8..e5194436ee 100644 --- a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/JobInstanceAttrToggleStrategy.java +++ b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/JobInstanceAttrToggleStrategy.java @@ -73,8 +73,8 @@ public class JobInstanceAttrToggleStrategy extends AbstractToggleStrategy { private Set operators; - public JobInstanceAttrToggleStrategy(String description, Map initParams) { - super(STRATEGY_ID, description, initParams); + public JobInstanceAttrToggleStrategy(Map initParams) { + super(STRATEGY_ID, initParams); String requireAllGseV2AgentAvailableValue = initParams.get(INIT_PARAM_REQUIRE_ALL_GSE_V2_AGENT_AVAILABLE); if (StringUtils.isNotBlank(requireAllGseV2AgentAvailableValue)) { requireAllGseV2AgentAvailable = Boolean.valueOf(requireAllGseV2AgentAvailableValue); @@ -121,7 +121,6 @@ public boolean evaluate(String featureId, FeatureExecutionContext ctx) { public String toString() { return new StringJoiner(", ", JobInstanceAttrToggleStrategy.class.getSimpleName() + "[", "]") .add("id='" + id + "'") - .add("description='" + description + "'") .add("initParams=" + initParams) .toString(); } diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/ResourceScopeBlackListToggleStrategy.java b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/ResourceScopeBlackListToggleStrategy.java index 9fdb18b2c4..11dab4c18d 100644 --- a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/ResourceScopeBlackListToggleStrategy.java +++ b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/ResourceScopeBlackListToggleStrategy.java @@ -39,8 +39,8 @@ public class ResourceScopeBlackListToggleStrategy extends AbstractResourceScopeT */ public static final String STRATEGY_ID = "ResourceScopeBlackListToggleStrategy"; - public ResourceScopeBlackListToggleStrategy(String description, Map initParams) { - super(STRATEGY_ID, description, initParams); + public ResourceScopeBlackListToggleStrategy(Map initParams) { + super(STRATEGY_ID, initParams); } @Override diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/ResourceScopeWhiteListToggleStrategy.java b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/ResourceScopeWhiteListToggleStrategy.java index 4b08520c1a..81838fc663 100644 --- a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/ResourceScopeWhiteListToggleStrategy.java +++ b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/ResourceScopeWhiteListToggleStrategy.java @@ -39,8 +39,8 @@ public class ResourceScopeWhiteListToggleStrategy extends AbstractResourceScopeT */ public static final String STRATEGY_ID = "ResourceScopeWhiteListToggleStrategy"; - public ResourceScopeWhiteListToggleStrategy(String description, Map initParams) { - super(STRATEGY_ID, description, initParams); + public ResourceScopeWhiteListToggleStrategy(Map initParams) { + super(STRATEGY_ID, initParams); } @Override diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/WeightToggleStrategy.java b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/WeightToggleStrategy.java index e716db7f7b..9d1d75ccda 100644 --- a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/WeightToggleStrategy.java +++ b/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/strategy/WeightToggleStrategy.java @@ -51,8 +51,8 @@ public class WeightToggleStrategy extends AbstractToggleStrategy { private final Random RANDOM = new SecureRandom(); - public WeightToggleStrategy(String description, Map initParams) { - super(STRATEGY_ID, description, initParams); + public WeightToggleStrategy(Map initParams) { + super(STRATEGY_ID, initParams); assertRequiredInitParam(INIT_PARAM_WEIGHT); String weightStrValue = initParams.get(INIT_PARAM_WEIGHT); this.weight = computeWeight(weightStrValue); diff --git a/src/backend/commons/common/src/test/java/com/tencent/bk/job/common/util/feature/FeatureToggleTest.java b/src/backend/commons/common-service/src/test/java/FeatureToggleTest.java similarity index 84% rename from src/backend/commons/common/src/test/java/com/tencent/bk/job/common/util/feature/FeatureToggleTest.java rename to src/backend/commons/common-service/src/test/java/FeatureToggleTest.java index 5ac967872f..ce7dc48dfe 100644 --- a/src/backend/commons/common/src/test/java/com/tencent/bk/job/common/util/feature/FeatureToggleTest.java +++ b/src/backend/commons/common-service/src/test/java/FeatureToggleTest.java @@ -22,38 +22,47 @@ * IN THE SOFTWARE. */ -package com.tencent.bk.job.common.util.feature; - import com.tencent.bk.job.common.constant.ResourceScopeTypeEnum; import com.tencent.bk.job.common.model.dto.ResourceScope; -import com.tencent.bk.job.common.service.config.FeatureToggleConfig; +import com.tencent.bk.job.common.service.feature.InMemoryFeatureStore; +import com.tencent.bk.job.common.service.feature.config.FeatureToggleConfig; +import com.tencent.bk.job.common.service.feature.strategy.JobInstanceAttrToggleStrategy; import com.tencent.bk.job.common.util.ApplicationContextRegister; -import com.tencent.bk.job.common.util.feature.strategy.JobInstanceAttrToggleStrategy; +import com.tencent.bk.job.common.util.feature.FeatureExecutionContext; +import com.tencent.bk.job.common.util.feature.FeatureIdConstants; +import com.tencent.bk.job.common.util.feature.FeatureStore; +import com.tencent.bk.job.common.util.feature.FeatureToggle; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.mockito.MockedStatic; import org.mockito.Mockito; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.Constructor; import java.io.InputStream; -import static com.tencent.bk.job.common.util.feature.strategy.ToggleStrategyContextParams.CTX_PARAM_RESOURCE_SCOPE; +import static com.tencent.bk.job.common.service.feature.strategy.ToggleStrategyContextParams.CTX_PARAM_RESOURCE_SCOPE; import static org.assertj.core.api.Assertions.assertThat; class FeatureToggleTest { @BeforeAll - static void load() { + static void beforeAll() { Yaml yaml = new Yaml(new Constructor(FeatureToggleConfig.class)); InputStream inputStream = FeatureToggleTest.class.getClassLoader() .getResourceAsStream("features_1.yaml"); FeatureToggleConfig featureToggleConfig = yaml.load(inputStream); - Mockito.mockStatic(ApplicationContextRegister.class) - .when(() -> ApplicationContextRegister.getBean(FeatureToggleConfig.class)) + MockedStatic mockedStatic = Mockito.mockStatic(ApplicationContextRegister.class); + mockedStatic.when(() -> ApplicationContextRegister.getBean(FeatureToggleConfig.class)) .thenReturn(featureToggleConfig); + FeatureStore mockedFeatureStore = new InMemoryFeatureStore(); + mockedFeatureStore.load(false); + mockedStatic.close(); - FeatureToggle.load(); + Mockito.mockStatic(ApplicationContextRegister.class) + .when(() -> ApplicationContextRegister.getBean(FeatureStore.class)) + .thenReturn(mockedFeatureStore); } @Test diff --git a/src/backend/commons/common/src/test/resources/features_1.yaml b/src/backend/commons/common-service/src/test/resources/features_1.yaml similarity index 54% rename from src/backend/commons/common/src/test/resources/features_1.yaml rename to src/backend/commons/common-service/src/test/resources/features_1.yaml index 00f2b3fa75..d064f87f32 100644 --- a/src/backend/commons/common/src/test/resources/features_1.yaml +++ b/src/backend/commons/common-service/src/test/resources/features_1.yaml @@ -2,33 +2,29 @@ features: gseV2: enabled: true strategy: + # 作业执行对接 GSE2.0 灰度策略。任一策略满足即可开启灰度 id: AnyMatchToggleStrategy - description: "作业执行对接 GSE2.0 灰度策略。任一策略满足即可开启灰度" strategies: + # 策略 1: 业务黑名单灰度策略,除了 Biz:2,Biz:100,biz:200, 其他业务都使用 GSE2.0 - id: ResourceScopeBlackListToggleStrategy - description: "策略 1: 业务黑名单灰度策略,除了 Biz:2,Biz:100,biz:200, 其他业务都使用 GSE2.0" params: resourceScopeList: "biz:2,biz:100,biz:200" + # 策略 2:如果业务ID=100 并且作业任务下的主机都是 2.0 gse agent,那么使用 GSE2.0 - id: AllMatchToggleStrategy - description: "策略 2:如果业务ID=100 并且作业任务下的主机都是 2.0 gse agent,那么使用 GSE2.0" strategies: - id: ResourceScopeWhiteListToggleStrategy - description: "业务 ID=100" params: resourceScopeList: "biz:100" - id: JobInstanceAttrToggleStrategy - description: "需要满足作业任务下的主机都是 2.0 gse agent" params: requireAllGseV2AgentAvailable: true + # 策略 2:如果业务ID=100 并且作业任务下的主机都是 2.0 gse agent,那么使用 GSE2.0 - id: AllMatchToggleStrategy - description: "策略 3:如果业务 ID=200,并且作业执行人是 admin,使用 GSE2.0" strategies: - id: ResourceScopeWhiteListToggleStrategy - description: "业务 ID=200" params: resourceScopeList: "biz:200" - id: JobInstanceAttrToggleStrategy - description: "作业执行人是 admin" params: operators: admin diff --git a/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/interceptor/AppResourceScopeInterceptor.java b/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/interceptor/AppResourceScopeInterceptor.java index 84d6d594c3..a5bfdd6aeb 100644 --- a/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/interceptor/AppResourceScopeInterceptor.java +++ b/src/backend/commons/common-web/src/main/java/com/tencent/bk/job/common/web/interceptor/AppResourceScopeInterceptor.java @@ -33,10 +33,10 @@ import com.tencent.bk.job.common.model.dto.AppResourceScope; import com.tencent.bk.job.common.model.dto.ResourceScope; import com.tencent.bk.job.common.service.AppScopeMappingService; -import com.tencent.bk.job.common.service.feature.FeatureIdConstants; -import com.tencent.bk.job.common.service.feature.FeatureToggle; import com.tencent.bk.job.common.util.JobContextUtil; import com.tencent.bk.job.common.util.RequestUtil; +import com.tencent.bk.job.common.util.feature.FeatureIdConstants; +import com.tencent.bk.job.common.util.feature.FeatureToggle; import com.tencent.bk.job.common.util.json.JsonUtils; import com.tencent.bk.job.common.web.model.RepeatableReadWriteHttpServletRequest; import lombok.extern.slf4j.Slf4j; diff --git a/src/backend/commons/common/build.gradle b/src/backend/commons/common/build.gradle index 1fcad9162c..e01861dcee 100644 --- a/src/backend/commons/common/build.gradle +++ b/src/backend/commons/common/build.gradle @@ -51,5 +51,4 @@ dependencies { annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.junit.jupiter:junit-jupiter' testImplementation 'org.springframework.boot:spring-boot-starter-test' - testImplementation 'org.mockito:mockito-inline' } diff --git a/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/util/feature/Feature.java b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/util/feature/Feature.java index 502741375d..04052b6c7e 100644 --- a/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/util/feature/Feature.java +++ b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/util/feature/Feature.java @@ -33,8 +33,6 @@ public class Feature { /** * 特性ID - * - * @see FeatureIdConstants */ private String id; /** diff --git a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/FeatureIdConstants.java b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/util/feature/FeatureIdConstants.java similarity index 97% rename from src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/FeatureIdConstants.java rename to src/backend/commons/common/src/main/java/com/tencent/bk/job/common/util/feature/FeatureIdConstants.java index fad97455aa..f81a1d12cf 100644 --- a/src/backend/commons/common-service/src/main/java/com/tencent/bk/job/common/service/feature/FeatureIdConstants.java +++ b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/util/feature/FeatureIdConstants.java @@ -22,7 +22,7 @@ * IN THE SOFTWARE. */ -package com.tencent.bk.job.common.service.feature; +package com.tencent.bk.job.common.util.feature; /** * 特性ID定义 diff --git a/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/util/feature/FeatureToggle.java b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/util/feature/FeatureToggle.java index 266f41b7f6..c50b3e31d5 100644 --- a/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/util/feature/FeatureToggle.java +++ b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/util/feature/FeatureToggle.java @@ -42,12 +42,6 @@ public class FeatureToggle { */ public static boolean checkFeature(String featureId, FeatureExecutionContext ctx) { FeatureStore featureStore = ApplicationContextRegister.getBean(FeatureStore.class); - if (featureStore == null) { - if (log.isDebugEnabled()) { - log.debug("Feature store is null, featureId: {}", featureId); - return false; - } - } Feature feature = featureStore.getFeature(featureId); if (log.isDebugEnabled()) { @@ -56,7 +50,6 @@ public static boolean checkFeature(String featureId, FeatureExecutionContext ctx if (feature == null) { if (log.isDebugEnabled()) { log.debug("Feature: {} is not exist!", featureId); - } return false; } diff --git a/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/util/feature/ToggleStrategy.java b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/util/feature/ToggleStrategy.java index 47464a3149..7b4d9400c8 100644 --- a/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/util/feature/ToggleStrategy.java +++ b/src/backend/commons/common/src/main/java/com/tencent/bk/job/common/util/feature/ToggleStrategy.java @@ -37,20 +37,13 @@ public interface ToggleStrategy { */ String getId(); - /** - * 获取策略说明 - */ - default String getDescription() { - return ""; - } - /** * 获取初始化参数 */ Map getInitParams(); /** - * 获取复合策略 + * 获取组合策略 */ default List getCompositeToggleStrategies() { return Collections.emptyList(); diff --git a/src/backend/gradle.properties b/src/backend/gradle.properties index c0fa9db161..f44fb10467 100644 --- a/src/backend/gradle.properties +++ b/src/backend/gradle.properties @@ -22,7 +22,7 @@ # IN THE SOFTWARE. # org.gradle.caching=true -org.gradle.parallel=true +org.gradle.parallel=false org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8 org.gradle.daemon=true org.gradle.daemon.idleTimeout=3600000 diff --git a/src/backend/job-analysis/boot-job-analysis/src/main/java/com/tencent/bk/job/analysis/JobAnalysisBootApplication.java b/src/backend/job-analysis/boot-job-analysis/src/main/java/com/tencent/bk/job/analysis/JobAnalysisBootApplication.java index d343faf227..2af3c4b249 100644 --- a/src/backend/job-analysis/boot-job-analysis/src/main/java/com/tencent/bk/job/analysis/JobAnalysisBootApplication.java +++ b/src/backend/job-analysis/boot-job-analysis/src/main/java/com/tencent/bk/job/analysis/JobAnalysisBootApplication.java @@ -25,7 +25,7 @@ package com.tencent.bk.job.analysis; import com.tencent.bk.job.common.service.boot.JobBootApplication; -import com.tencent.bk.job.common.service.feature.FeatureToggleConfig; +import com.tencent.bk.job.common.service.feature.config.FeatureToggleConfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration; import org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration; diff --git a/src/backend/job-assemble/src/main/java/com/tencent/bk/job/assemble/JobAssembleBootApplication.java b/src/backend/job-assemble/src/main/java/com/tencent/bk/job/assemble/JobAssembleBootApplication.java index 1d5fa6e92d..b1aaf0155f 100644 --- a/src/backend/job-assemble/src/main/java/com/tencent/bk/job/assemble/JobAssembleBootApplication.java +++ b/src/backend/job-assemble/src/main/java/com/tencent/bk/job/assemble/JobAssembleBootApplication.java @@ -25,7 +25,7 @@ package com.tencent.bk.job.assemble; import com.tencent.bk.job.common.service.boot.JobBootApplication; -import com.tencent.bk.job.common.service.feature.FeatureToggleConfig; +import com.tencent.bk.job.common.service.feature.config.FeatureToggleConfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration; import org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration; diff --git a/src/backend/job-backup/boot-job-backup/src/main/java/com/tencent/bk/job/backup/JobBackupBootApplication.java b/src/backend/job-backup/boot-job-backup/src/main/java/com/tencent/bk/job/backup/JobBackupBootApplication.java index abe7e69fa2..cee670e80e 100644 --- a/src/backend/job-backup/boot-job-backup/src/main/java/com/tencent/bk/job/backup/JobBackupBootApplication.java +++ b/src/backend/job-backup/boot-job-backup/src/main/java/com/tencent/bk/job/backup/JobBackupBootApplication.java @@ -25,7 +25,7 @@ package com.tencent.bk.job.backup; import com.tencent.bk.job.common.service.boot.JobBootApplication; -import com.tencent.bk.job.common.service.feature.FeatureToggleConfig; +import com.tencent.bk.job.common.service.feature.config.FeatureToggleConfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration; import org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration; diff --git a/src/backend/job-crontab/boot-job-crontab/src/main/java/com/tencent/bk/job/crontab/JobCrontabBootApplication.java b/src/backend/job-crontab/boot-job-crontab/src/main/java/com/tencent/bk/job/crontab/JobCrontabBootApplication.java index 796af8416d..27b80376d8 100644 --- a/src/backend/job-crontab/boot-job-crontab/src/main/java/com/tencent/bk/job/crontab/JobCrontabBootApplication.java +++ b/src/backend/job-crontab/boot-job-crontab/src/main/java/com/tencent/bk/job/crontab/JobCrontabBootApplication.java @@ -25,7 +25,7 @@ package com.tencent.bk.job.crontab; import com.tencent.bk.job.common.service.boot.JobBootApplication; -import com.tencent.bk.job.common.service.feature.FeatureToggleConfig; +import com.tencent.bk.job.common.service.feature.config.FeatureToggleConfig; import com.tencent.bk.job.crontab.config.JobQuartzProperties; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration; diff --git a/src/backend/job-execute/boot-job-execute/src/main/java/com/tencent/bk/job/execute/JobExecuteBootApplication.java b/src/backend/job-execute/boot-job-execute/src/main/java/com/tencent/bk/job/execute/JobExecuteBootApplication.java index 8345c90fb3..3806676757 100644 --- a/src/backend/job-execute/boot-job-execute/src/main/java/com/tencent/bk/job/execute/JobExecuteBootApplication.java +++ b/src/backend/job-execute/boot-job-execute/src/main/java/com/tencent/bk/job/execute/JobExecuteBootApplication.java @@ -25,7 +25,7 @@ package com.tencent.bk.job.execute; import com.tencent.bk.job.common.service.boot.JobBootApplication; -import com.tencent.bk.job.common.service.feature.FeatureToggleConfig; +import com.tencent.bk.job.common.service.feature.config.FeatureToggleConfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration; import org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration; diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/result/FileResultHandleTask.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/result/FileResultHandleTask.java index 9ef8a4508d..1182eb90f2 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/result/FileResultHandleTask.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/engine/result/FileResultHandleTask.java @@ -35,8 +35,10 @@ import com.tencent.bk.job.common.gse.v2.model.FileTaskResult; import com.tencent.bk.job.common.gse.v2.model.GetTransferFileResultRequest; import com.tencent.bk.job.common.model.dto.HostDTO; -import com.tencent.bk.job.common.service.feature.FeatureIdConstants; -import com.tencent.bk.job.common.service.feature.FeatureToggle; +import com.tencent.bk.job.common.service.feature.strategy.ToggleStrategyContextParams; +import com.tencent.bk.job.common.util.feature.FeatureExecutionContext; +import com.tencent.bk.job.common.util.feature.FeatureIdConstants; +import com.tencent.bk.job.common.util.feature.FeatureToggle; import com.tencent.bk.job.common.util.ip.IpUtils; import com.tencent.bk.job.common.util.json.JsonUtils; import com.tencent.bk.job.execute.common.constants.FileDistStatusEnum; @@ -383,7 +385,8 @@ private boolean isSupportProtocolBeforeV2() { return FeatureToggle.checkFeature( FeatureIdConstants.GSE_FILE_PROTOCOL_BEFORE_V2, FeatureExecutionContext.builder() - .addResourceScopeContextParam(GlobalAppScopeMappingService.get().getScopeByAppId(appId)) + .addContextParam(ToggleStrategyContextParams.CTX_PARAM_RESOURCE_SCOPE, + GlobalAppScopeMappingService.get().getScopeByAppId(appId)) ); } diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/service/impl/TaskExecuteServiceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/service/impl/TaskExecuteServiceImpl.java index c00649a24c..9e4f04b0b3 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/service/impl/TaskExecuteServiceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/service/impl/TaskExecuteServiceImpl.java @@ -50,13 +50,15 @@ import com.tencent.bk.job.common.model.dto.AppResourceScope; import com.tencent.bk.job.common.model.dto.HostDTO; import com.tencent.bk.job.common.service.AppScopeMappingService; -import com.tencent.bk.job.common.service.feature.FeatureIdConstants; -import com.tencent.bk.job.common.service.feature.FeatureToggle; import com.tencent.bk.job.common.service.feature.strategy.JobInstanceAttrToggleStrategy; +import com.tencent.bk.job.common.service.feature.strategy.ToggleStrategyContextParams; import com.tencent.bk.job.common.util.ArrayUtil; import com.tencent.bk.job.common.util.DataSizeConverter; import com.tencent.bk.job.common.util.ListUtil; import com.tencent.bk.job.common.util.date.DateUtils; +import com.tencent.bk.job.common.util.feature.FeatureExecutionContext; +import com.tencent.bk.job.common.util.feature.FeatureIdConstants; +import com.tencent.bk.job.common.util.feature.FeatureToggle; import com.tencent.bk.job.common.util.json.JsonUtils; import com.tencent.bk.job.execute.audit.ExecuteJobAuditEventBuilder; import com.tencent.bk.job.execute.auth.ExecuteAuthService; @@ -961,7 +963,8 @@ private boolean isUsingGseV2(TaskInstanceDTO taskInstance, Collection t // 初始化Job任务灰度对接 GSE2.0 上下文 FeatureExecutionContext featureExecutionContext = FeatureExecutionContext.builder() - .addResourceScopeContextParam(appScopeMappingService.getScopeByAppId(taskInstance.getAppId())) + .addContextParam(ToggleStrategyContextParams.CTX_PARAM_RESOURCE_SCOPE, + appScopeMappingService.getScopeByAppId(taskInstance.getAppId())) .addContextParam(JobInstanceAttrToggleStrategy.CTX_PARAM_IS_ALL_GSE_V2_AGENT_AVAILABLE, taskInstanceHosts.stream().noneMatch(host -> { // AgentId 为空或者为 V1 格式的 diff --git a/src/backend/job-file-gateway/boot-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/JobFileGatewayBootApplication.java b/src/backend/job-file-gateway/boot-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/JobFileGatewayBootApplication.java index d37702eef9..c533cb6fc9 100644 --- a/src/backend/job-file-gateway/boot-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/JobFileGatewayBootApplication.java +++ b/src/backend/job-file-gateway/boot-job-file-gateway/src/main/java/com/tencent/bk/job/file_gateway/JobFileGatewayBootApplication.java @@ -25,7 +25,7 @@ package com.tencent.bk.job.file_gateway; import com.tencent.bk.job.common.service.boot.JobBootApplication; -import com.tencent.bk.job.common.service.feature.FeatureToggleConfig; +import com.tencent.bk.job.common.service.feature.config.FeatureToggleConfig; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration; diff --git a/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/JobGatewayBootApplication.java b/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/JobGatewayBootApplication.java index 1238ff4241..03156999fc 100644 --- a/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/JobGatewayBootApplication.java +++ b/src/backend/job-gateway/src/main/java/com/tencent/bk/job/gateway/JobGatewayBootApplication.java @@ -25,7 +25,7 @@ package com.tencent.bk.job.gateway; import com.tencent.bk.job.common.service.boot.JobBootApplication; -import com.tencent.bk.job.common.service.feature.FeatureToggleConfig; +import com.tencent.bk.job.common.service.feature.config.FeatureToggleConfig; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; diff --git a/src/backend/job-logsvr/boot-job-logsvr/src/main/java/com/tencent/bk/job/logsvr/JobLogBootApplication.java b/src/backend/job-logsvr/boot-job-logsvr/src/main/java/com/tencent/bk/job/logsvr/JobLogBootApplication.java index 40dcd11b0e..a0f17b7e7d 100644 --- a/src/backend/job-logsvr/boot-job-logsvr/src/main/java/com/tencent/bk/job/logsvr/JobLogBootApplication.java +++ b/src/backend/job-logsvr/boot-job-logsvr/src/main/java/com/tencent/bk/job/logsvr/JobLogBootApplication.java @@ -25,7 +25,7 @@ package com.tencent.bk.job.logsvr; import com.tencent.bk.job.common.service.boot.JobBootApplication; -import com.tencent.bk.job.common.service.feature.FeatureToggleConfig; +import com.tencent.bk.job.common.service.feature.config.FeatureToggleConfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration; import org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration; diff --git a/src/backend/job-manage/boot-job-manage/src/main/java/com/tencent/bk/job/manage/JobManageBootApplication.java b/src/backend/job-manage/boot-job-manage/src/main/java/com/tencent/bk/job/manage/JobManageBootApplication.java index beb3b5f3da..8421b9d32e 100644 --- a/src/backend/job-manage/boot-job-manage/src/main/java/com/tencent/bk/job/manage/JobManageBootApplication.java +++ b/src/backend/job-manage/boot-job-manage/src/main/java/com/tencent/bk/job/manage/JobManageBootApplication.java @@ -25,7 +25,7 @@ package com.tencent.bk.job.manage; import com.tencent.bk.job.common.service.boot.JobBootApplication; -import com.tencent.bk.job.common.service.feature.FeatureToggleConfig; +import com.tencent.bk.job.common.service.feature.config.FeatureToggleConfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration; import org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration; diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/GlobalSettingsServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/GlobalSettingsServiceImpl.java index 8f0d3c1401..8b5f65b106 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/GlobalSettingsServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/GlobalSettingsServiceImpl.java @@ -33,12 +33,12 @@ import com.tencent.bk.job.common.i18n.locale.LocaleUtils; import com.tencent.bk.job.common.i18n.service.MessageI18nService; import com.tencent.bk.job.common.iam.constant.ActionId; -import com.tencent.bk.job.common.service.feature.FeatureIdConstants; -import com.tencent.bk.job.common.service.feature.FeatureToggle; import com.tencent.bk.job.common.util.JobContextUtil; import com.tencent.bk.job.common.util.StringUtil; import com.tencent.bk.job.common.util.TimeUtil; import com.tencent.bk.job.common.util.date.DateUtils; +import com.tencent.bk.job.common.util.feature.FeatureIdConstants; +import com.tencent.bk.job.common.util.feature.FeatureToggle; import com.tencent.bk.job.common.util.json.JsonUtils; import com.tencent.bk.job.manage.common.consts.globalsetting.GlobalSettingKeys; import com.tencent.bk.job.manage.common.consts.globalsetting.OSTypeEnum;