This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
The following commit(s) were added to refs/heads/master by this push:
new e7d67b090 [#4412]add alarms for using old deprecated configuration
(#4431)
e7d67b090 is described below
commit e7d67b090be91984ae0c2d9d7a2b3cb3a3b1e5fd
Author: liubao68 <[email protected]>
AuthorDate: Sat Jul 27 14:25:22 2024 +0800
[#4412]add alarms for using old deprecated configuration (#4431)
---
.../core/bootup/ConfigurationProblemsCollector.java | 14 ++++++++++++++
.../server/ConfigurationProblemsCollectorTest.java | 4 +++-
.../springmvc-server/src/main/resources/microservice.yaml | 5 +++++
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git
a/core/src/main/java/org/apache/servicecomb/core/bootup/ConfigurationProblemsCollector.java
b/core/src/main/java/org/apache/servicecomb/core/bootup/ConfigurationProblemsCollector.java
index bcf85dbda..12ba6d057 100644
---
a/core/src/main/java/org/apache/servicecomb/core/bootup/ConfigurationProblemsCollector.java
+++
b/core/src/main/java/org/apache/servicecomb/core/bootup/ConfigurationProblemsCollector.java
@@ -37,6 +37,7 @@ public class ConfigurationProblemsCollector implements
BootUpInformationCollecto
collectCsePrefix(engine.getEnvironment(), result);
collectServiceDefinition(engine.getEnvironment(), result);
collectTimeoutConfiguration(engine.getEnvironment(), result);
+ collectIsolationConfiguration(engine.getEnvironment(), result);
if (result.isEmpty()) {
return null;
}
@@ -45,6 +46,19 @@ public class ConfigurationProblemsCollector implements
BootUpInformationCollecto
return warnings;
}
+ private void collectIsolationConfiguration(Environment environment,
StringBuilder result) {
+ int percentage = environment.getProperty(
+ "servicecomb.loadbalance.isolation.errorThresholdPercentage",
int.class, -1);
+ int continuous = environment.getProperty(
+ "servicecomb.loadbalance.isolation.continuousFailureThreshold",
int.class, -1);
+ if (percentage == -1 && continuous == -1) {
+ return;
+ }
+ result.append("Configuration `servicecomb.loadbalance.isolation.*` is
removed, use governance instead. "
+ + "See https://servicecomb.apache.org/references/java-chassis/"
+ + "zh_CN/references-handlers/governance-best-practise.html");
+ }
+
private void collectTimeoutConfiguration(Environment environment,
StringBuilder result) {
int keepAliveTimeoutInSeconds = environment.getProperty(
"servicecomb.rest.client.connection.keepAliveTimeoutInSeconds",
int.class, 60);
diff --git
a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ConfigurationProblemsCollectorTest.java
b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ConfigurationProblemsCollectorTest.java
index 3fcfca300..e8c42f1a4 100644
---
a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ConfigurationProblemsCollectorTest.java
+++
b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/ConfigurationProblemsCollectorTest.java
@@ -42,6 +42,8 @@ public class ConfigurationProblemsCollectorTest implements
CategorizedTestCase {
TestMgr.check(event != null, true);
TestMgr.check(event.getProblems(), "Configurations warnings:\n" +
"Configurations with prefix `service_description` is deprecated, "
- + "use `servicecomb.service` instead. Find keys
[service_description.initialStatus]\n");
+ + "use `servicecomb.service` instead. Find keys
[service_description.initialStatus]\n"
+ + "Configuration `servicecomb.loadbalance.isolation.*` is removed, use
governance instead. "
+ + "See
https://servicecomb.apache.org/references/java-chassis/zh_CN/references-handlers/governance-best-practise.html");
}
}
diff --git
a/demo/demo-springmvc/springmvc-server/src/main/resources/microservice.yaml
b/demo/demo-springmvc/springmvc-server/src/main/resources/microservice.yaml
index 7f6579af9..9e477a079 100644
--- a/demo/demo-springmvc/springmvc-server/src/main/resources/microservice.yaml
+++ b/demo/demo-springmvc/springmvc-server/src/main/resources/microservice.yaml
@@ -73,6 +73,11 @@ servicecomb:
region: my-Region
availableZone: my-Zone
codec.printErrorMessage: true
+
+ # For old testing
+ loadbalance:
+ isolation:
+ errorThresholdPercentage: 20
#########SSL options
# open jdk 8 now TLSv1.3 not available
# ssl.protocols: TLSv1.3