fix:fix reporter wrong initialization when using config data. (#1220)

pull/1230/head
Haotian Zhang 10 months ago committed by GitHub
parent 2cd52eb6da
commit d7fd8e3ffe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,3 +20,4 @@
- [feat: support nacos namespace mapping](https://github.com/Tencent/spring-cloud-tencent/pull/1190) - [feat: support nacos namespace mapping](https://github.com/Tencent/spring-cloud-tencent/pull/1190)
- [fix:fix rule-based router when using RestTemplate.](https://github.com/Tencent/spring-cloud-tencent/pull/1202) - [fix:fix rule-based router when using RestTemplate.](https://github.com/Tencent/spring-cloud-tencent/pull/1202)
- [fix:fix sct-all wrong spring boot version obtain.](https://github.com/Tencent/spring-cloud-tencent/pull/1206) - [fix:fix sct-all wrong spring boot version obtain.](https://github.com/Tencent/spring-cloud-tencent/pull/1206)
- [fix:fix reporter wrong initialization when using config data.](https://github.com/Tencent/spring-cloud-tencent/pull/1220)

@ -31,6 +31,7 @@ import com.tencent.cloud.polaris.context.PolarisConfigModifier;
import com.tencent.cloud.polaris.context.config.PolarisContextProperties; import com.tencent.cloud.polaris.context.config.PolarisContextProperties;
import com.tencent.polaris.api.utils.StringUtils; import com.tencent.polaris.api.utils.StringUtils;
import com.tencent.polaris.client.api.SDKContext; import com.tencent.polaris.client.api.SDKContext;
import com.tencent.polaris.factory.config.ConfigurationImpl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.springframework.boot.BootstrapRegistry; import org.springframework.boot.BootstrapRegistry;
@ -267,6 +268,10 @@ public class PolarisConfigDataLocationResolver implements
if (!bootstrapContext.isRegistered(SDKContext.class)) { if (!bootstrapContext.isRegistered(SDKContext.class)) {
SDKContext sdkContext = sdkContext(resolverContext, SDKContext sdkContext = sdkContext(resolverContext,
polarisConfigProperties, polarisCryptoConfigProperties, polarisContextProperties); polarisConfigProperties, polarisCryptoConfigProperties, polarisContextProperties);
// not init reporter when creating config data temp SDK context.
if (sdkContext.getConfig() instanceof ConfigurationImpl) {
((ConfigurationImpl) sdkContext.getConfig()).getGlobal().getStatReporter().setEnable(false);
}
sdkContext.init(); sdkContext.init();
bootstrapContext.register(SDKContext.class, BootstrapRegistry.InstanceSupplier.of(sdkContext)); bootstrapContext.register(SDKContext.class, BootstrapRegistry.InstanceSupplier.of(sdkContext));
} }

Loading…
Cancel
Save