You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2022/07/05 02:47:26 UTC
[GitHub] [servicecomb-java-chassis] zhaozw opened a new pull request, #3140: [SCB-2330] add injectFault into governance
zhaozw opened a new pull request, #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140
Follow this checklist to help us incorporate your contribution quickly and easily:
- [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue.
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [ ] Run `mvn clean install -Pit` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
- [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
---
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#discussion_r913679249
##########
governance/src/main/java/org/apache/servicecomb/governance/policy/FaultInjectionPolicy.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.governance.policy;
+
+import java.time.Duration;
+
+public class FaultInjectionPolicy extends AbstractPolicy {
+ public static final Duration DEFAULT_TIMEOUT_DURATION = Duration.ofMillis(0);
+
+ private String type = "delay";
+
+ private String delayTime = DEFAULT_TIMEOUT_DURATION.toString();
+
+ private int percentage = -1;
+
+ private int errorCode = -1;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDelayTime() {
+ return delayTime;
+ }
+
+ public void setDelayTime(String delayTime) {
+ this.delayTime = stringOfDuration(delayTime, Duration.ofMillis(-1));
+ }
+
+ public int getPercentage() {
+ return percentage;
+ }
+
+ public void setPercentage(int percentage) {
+ this.percentage = percentage;
+ }
+
+ public int getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(int errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public long getDelayTimeToMillis() {
+ return Duration.parse(delayTime).toMillis();
+ }
+
+ @Override
+ public boolean isValid() {
+ if (getDelayTimeToMillis() < 0 && "delay".equals(type)) {
+ return false;
+ }
+ if ((getErrorCode() < 200 || getErrorCode() > 600) && "abort".equals(type)) {
Review Comment:
use constant
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] zhaozw closed pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
zhaozw closed pull request #3140: [SCB-2330] add injectFault into governance
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
liubao68 merged PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#discussion_r912593224
##########
governance/src/test/java/org/apache/servicecomb/governance/FlowControlTest.java:
##########
@@ -123,4 +132,93 @@ public void test_rate_limiting_service_name_work() throws Throwable {
Assertions.assertTrue(expected.get());
Assertions.assertFalse(notExpected.get());
}
+
+ @Test
+ public void test_delay_fault_injection_service_name_work() throws Throwable {
+ DecorateCheckedSupplier<Object> ds = Decorators.ofCheckedSupplier(() -> "test");
+
+ GovernanceRequest request = new GovernanceRequest();
+ request.setUri("/faultInjectDelay");
+ request.setServiceName("srcService");
+
+ Fault fault = faultInjectionHandler.getActuator(request);
+
+ Assertions.assertEquals("test", ds.get());
+
+ // flow control
+ CountDownLatch cd = new CountDownLatch(10);
+ AtomicBoolean notExpected = new AtomicBoolean(false);
+ AtomicBoolean delayExpected = new AtomicBoolean(false);
+ AtomicBoolean abortExpected = new AtomicBoolean(false);
+ for (int i = 0; i < 10; i++) {
+ new Thread(() -> {
+ fault.injectFault(faultResponse -> {
+ if (faultResponse.isDelay()) {
+ delayExpected.set(true);
+ } else if (!faultResponse.isSuccess()) {
+ abortExpected.set(true);
+ } else {
+ try {
+ Object result = ds.get();
+ if (!"test".equals(result)) {
+ notExpected.set(true);
+ }
+ } catch (Throwable e) {
+ notExpected.set(true);
+ }
+ }
+ cd.countDown();
+ });
+ }).start();
+ }
+ //timeout should be bigger than delayTime
+ cd.await(10, TimeUnit.SECONDS);
+ Assertions.assertFalse(notExpected.get());
+ Assertions.assertFalse(abortExpected.get());
+ Assertions.assertTrue(delayExpected.get());
+ }
+
+ @Test
+ public void test_abort_fault_injection_service_name_work() throws Throwable {
+ DecorateCheckedSupplier<Object> ds = Decorators.ofCheckedSupplier(() -> "test");
+
+ GovernanceRequest request = new GovernanceRequest();
+ request.setUri("/faultInjectAbort");
+ request.setServiceName("srcService");
+
+ Fault fault = faultInjectionHandler.getActuator(request);
+
+ Assertions.assertEquals("test", ds.get());
+
+ // flow control
+ CountDownLatch cd = new CountDownLatch(10);
+ AtomicBoolean notExpected = new AtomicBoolean(false);
+ AtomicBoolean delayExpected = new AtomicBoolean(false);
+ AtomicBoolean abortExpected = new AtomicBoolean(false);
+ for (int i = 0; i < 10; i++) {
+ new Thread(() -> {
+ fault.injectFault(faultResponse -> {
Review Comment:
From the usage, seems the users need to call Fault api himself. This is not a correct usage case.
see FlowControlTests for usage exampes. We should call ds.get and expecting errors.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] zhaozw commented on a diff in pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
zhaozw commented on code in PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#discussion_r909619414
##########
governance/src/main/java/org/apache/servicecomb/governance/handler/FaultInjectionHandler.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.governance.handler;
+
+import org.apache.servicecomb.governance.marker.GovernanceRequest;
+import org.apache.servicecomb.governance.policy.FaultInjectionPolicy;
+import org.apache.servicecomb.governance.properties.FaultInjectionProperties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class FaultInjectionHandler extends AbstractGovernanceHandler<FaultInjectionPolicy, FaultInjectionPolicy> {
+ private static final Logger LOGGER = LoggerFactory.getLogger(FaultInjectionHandler.class);
+
+ @Autowired
+ private FaultInjectionProperties faultInjectionProperties;
+
+ @Override
+ protected String createKey(GovernanceRequest governanceRequest, FaultInjectionPolicy policy) {
+ return "servicecomb.faultInjection." + policy.getName();
+ }
+
+ @Override
+ public FaultInjectionPolicy matchPolicy(GovernanceRequest governanceRequest) {
+ return matchersManager.match(governanceRequest, faultInjectionProperties.getParsedEntity());
+ }
+
+ @Override
+ protected FaultInjectionPolicy createProcessor(String key, GovernanceRequest governanceRequest,
Review Comment:
OK
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#discussion_r913345849
##########
governance/src/test/java/org/apache/servicecomb/governance/FaultInjectionTest.java:
##########
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.governance;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.servicecomb.governance.handler.FaultInjectionHandler;
+import org.apache.servicecomb.governance.marker.GovernanceRequest;
+import org.apache.servicecomb.injection.Fault;
+import org.apache.servicecomb.injection.FaultInjectionException;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ContextConfiguration;
+
+import io.github.resilience4j.decorators.Decorators;
+import io.github.resilience4j.decorators.Decorators.DecorateCheckedSupplier;
+
+@SpringBootTest
+@ContextConfiguration(classes = {GovernanceConfiguration.class, MockConfiguration.class})
+public class FaultInjectionTest {
+ private FaultInjectionHandler faultInjectionHandler;
+
+ @Autowired
+ public void setFaultInjectionHandler(FaultInjectionHandler faultInjectionHandler) {
+ this.faultInjectionHandler = faultInjectionHandler;
+ }
+
+ public FaultInjectionTest() {
+ }
+
+ @Test
+ public void test_delay_fault_injection_service_name_work() throws Throwable {
+ DecorateCheckedSupplier<Object> dcs = Decorators.ofCheckedSupplier(() -> "test");
Review Comment:
Maybe FaultInjectionDecorators create a FaultInjectionDecorateCheckedSupplier is simpler
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#discussion_r913679015
##########
governance/src/main/java/org/apache/servicecomb/governance/policy/FaultInjectionPolicy.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.governance.policy;
+
+import java.time.Duration;
+
+public class FaultInjectionPolicy extends AbstractPolicy {
+ public static final Duration DEFAULT_TIMEOUT_DURATION = Duration.ofMillis(0);
+
+ private String type = "delay";
+
+ private String delayTime = DEFAULT_TIMEOUT_DURATION.toString();
+
+ private int percentage = -1;
+
+ private int errorCode = -1;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDelayTime() {
+ return delayTime;
+ }
+
+ public void setDelayTime(String delayTime) {
+ this.delayTime = stringOfDuration(delayTime, Duration.ofMillis(-1));
+ }
+
+ public int getPercentage() {
+ return percentage;
+ }
+
+ public void setPercentage(int percentage) {
+ this.percentage = percentage;
+ }
+
+ public int getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(int errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public long getDelayTimeToMillis() {
+ return Duration.parse(delayTime).toMillis();
+ }
+
+ @Override
+ public boolean isValid() {
+ if (getDelayTimeToMillis() < 0 && "delay".equals(type)) {
Review Comment:
use constant
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] zhaozw closed pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
zhaozw closed pull request #3140: [SCB-2330] add injectFault into governance
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#discussion_r909488668
##########
governance/src/main/java/org/apache/servicecomb/governance/handler/FaultInjectionHandler.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.governance.handler;
+
+import org.apache.servicecomb.governance.marker.GovernanceRequest;
+import org.apache.servicecomb.governance.policy.FaultInjectionPolicy;
+import org.apache.servicecomb.governance.properties.FaultInjectionProperties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class FaultInjectionHandler extends AbstractGovernanceHandler<FaultInjectionPolicy, FaultInjectionPolicy> {
+ private static final Logger LOGGER = LoggerFactory.getLogger(FaultInjectionHandler.class);
+
+ @Autowired
+ private FaultInjectionProperties faultInjectionProperties;
+
+ @Override
+ protected String createKey(GovernanceRequest governanceRequest, FaultInjectionPolicy policy) {
+ return "servicecomb.faultInjection." + policy.getName();
+ }
+
+ @Override
+ public FaultInjectionPolicy matchPolicy(GovernanceRequest governanceRequest) {
+ return matchersManager.match(governanceRequest, faultInjectionProperties.getParsedEntity());
+ }
+
+ @Override
+ protected FaultInjectionPolicy createProcessor(String key, GovernanceRequest governanceRequest,
Review Comment:
I think it's better create a test case like FlowControlTest to demonstrator how to use this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] codecov-commenter commented on pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#issuecomment-1167493203
# [Codecov](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#3140](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ea819fe) into [master](https://codecov.io/gh/apache/servicecomb-java-chassis/commit/07538ee6acf4bc856c1f00c2bc84d30e2a5a7574?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (07538ee) will **decrease** coverage by `0.14%`.
> The diff coverage is `25.42%`.
> :exclamation: Current head ea819fe differs from pull request most recent head 42e6c26. Consider uploading reports for the commit 42e6c26 to get more accurate results
```diff
@@ Coverage Diff @@
## master #3140 +/- ##
============================================
- Coverage 77.45% 77.30% -0.15%
Complexity 1440 1440
============================================
Files 1618 1627 +9
Lines 43312 43430 +118
Branches 3643 3650 +7
============================================
+ Hits 33547 33575 +28
- Misses 8265 8352 +87
- Partials 1500 1503 +3
```
| [Impacted Files](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...che/servicecomb/injection/FaultInjectionConst.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z292ZXJuYW5jZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvaW5qZWN0aW9uL0ZhdWx0SW5qZWN0aW9uQ29uc3QuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...ache/servicecomb/injection/FaultInjectionUtil.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z292ZXJuYW5jZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvaW5qZWN0aW9uL0ZhdWx0SW5qZWN0aW9uVXRpbC5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...a/org/apache/servicecomb/injection/FaultParam.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z292ZXJuYW5jZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvaW5qZWN0aW9uL0ZhdWx0UGFyYW0uamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...rg/apache/servicecomb/injection/FaultResponse.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z292ZXJuYW5jZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvaW5qZWN0aW9uL0ZhdWx0UmVzcG9uc2UuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...a/org/apache/servicecomb/injection/DelayFault.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z292ZXJuYW5jZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvaW5qZWN0aW9uL0RlbGF5RmF1bHQuamF2YQ==) | `8.33% <8.33%> (ø)` | |
| [...a/org/apache/servicecomb/injection/AbortFault.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z292ZXJuYW5jZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvaW5qZWN0aW9uL0Fib3J0RmF1bHQuamF2YQ==) | `10.52% <10.52%> (ø)` | |
| [...comb/governance/handler/FaultInjectionHandler.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z292ZXJuYW5jZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvZ292ZXJuYW5jZS9oYW5kbGVyL0ZhdWx0SW5qZWN0aW9uSGFuZGxlci5qYXZh) | `40.00% <40.00%> (ø)` | |
| [...cecomb/governance/policy/FaultInjectionPolicy.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z292ZXJuYW5jZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvZ292ZXJuYW5jZS9wb2xpY3kvRmF1bHRJbmplY3Rpb25Qb2xpY3kuamF2YQ==) | `80.00% <80.00%> (ø)` | |
| [...ervicecomb/governance/GovernanceConfiguration.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z292ZXJuYW5jZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvZ292ZXJuYW5jZS9Hb3Zlcm5hbmNlQ29uZmlndXJhdGlvbi5qYXZh) | `100.00% <100.00%> (ø)` | |
| [...overnance/properties/FaultInjectionProperties.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z292ZXJuYW5jZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvZ292ZXJuYW5jZS9wcm9wZXJ0aWVzL0ZhdWx0SW5qZWN0aW9uUHJvcGVydGllcy5qYXZh) | `100.00% <100.00%> (ø)` | |
| ... and [1 more](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [07538ee...42e6c26](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/3140?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#discussion_r913681207
##########
governance/src/main/java/org/apache/servicecomb/injection/DelayFault.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.injection;
+
+import org.apache.servicecomb.governance.policy.FaultInjectionPolicy;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DelayFault extends AbstractFault {
+ private static final Logger LOGGER = LoggerFactory.getLogger(DelayFault.class);
+
+ public DelayFault(String key, FaultInjectionPolicy policy) {
+ super(key, policy);
+ }
+
+ @Override
+ public int getOrder() {
+ return 100;
+ }
+
+ @Override
+ public void injectFault(FaultParam faultParam) {
+ if (!shouldDelay(faultParam, policy)) {
+ return;
+ }
+
+ LOGGER.debug("Fault injection: delay is added for the request by fault inject handler");
+ long delay = policy.getDelayTimeToMillis();
+ if (delay == FaultInjectionConst.FAULT_INJECTION_DEFAULT_VALUE) {
+ LOGGER.debug("Fault injection: delay is not configured");
+ return;
+ }
+
+ executeDelay(faultParam, delay);
+ }
+
+ private void executeDelay(FaultParam faultParam, long delay) {
+ Sleepable sleepable = faultParam.getSleepable();
+ if (sleepable != null) {
+ sleepable.sleep(delay);
+ }
+ }
+
+ private boolean shouldDelay(FaultParam param, FaultInjectionPolicy policy) {
+ int delayPercent = policy.getPercentage();
+ if (delayPercent == FaultInjectionConst.FAULT_INJECTION_DEFAULT_VALUE) {
+ LOGGER.debug("Fault injection: delay percentage is not configured");
+ return false;
+ }
+ // check fault delay condition.
+ return FaultInjectionUtil.isFaultNeedToInject(param.getReqCount(), delayPercent);
+ }
+
+ @Override
+ public String getName() {
+ return "delay";
Review Comment:
a lot of places use this literal, consider use constant
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#discussion_r917588411
##########
governance/src/main/java/org/apache/servicecomb/injection/FaultResponse.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.injection;
+
+public class FaultResponse {
+
+ private int errorCode;
+
+ private String errorMsg;
+
+ private boolean delay;
+
+ public static FaultResponse createFail(int errorCode, String errorMsg) {
+ FaultResponse faultResponse = new FaultResponse();
+ faultResponse.setErrorCode(errorCode);
+ faultResponse.setErrorMsg(errorMsg);
+ return faultResponse;
+ }
+
+ public int getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(int errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public String getErrorMsg() {
+ return errorMsg;
+ }
+
+ public void setErrorMsg(String errorMsg) {
+ this.errorMsg = errorMsg;
+ }
+
+ public boolean isDelay() {
+ return delay;
+ }
+
+ public void setDelay(boolean delay) {
Review Comment:
setDelay is never used, can be deleted
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#discussion_r913678739
##########
governance/src/main/java/org/apache/servicecomb/governance/policy/FaultInjectionPolicy.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.governance.policy;
+
+import java.time.Duration;
+
+public class FaultInjectionPolicy extends AbstractPolicy {
+ public static final Duration DEFAULT_TIMEOUT_DURATION = Duration.ofMillis(0);
+
+ private String type = "delay";
Review Comment:
declare a constant
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#discussion_r917588902
##########
governance/src/main/java/org/apache/servicecomb/injection/Fault.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.injection;
+
+import io.vavr.CheckedFunction0;
+
+public interface Fault {
+ static <T> CheckedFunction0<T> decorateCheckedSupplier(Fault fault, CheckedFunction0<T> supplier) {
+ return () -> {
+ try {
+ fault.injectFault();
+ } catch (FaultInjectionException exception) {
+ if (!exception.getFaultResponse().isDelay()) {
+ throw exception;
+ }
Review Comment:
try/catch is useless. DelayFault will not throw FaultInjectionException
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#discussion_r909487604
##########
governance/src/main/java/org/apache/servicecomb/governance/handler/FaultInjectionHandler.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.governance.handler;
+
+import org.apache.servicecomb.governance.marker.GovernanceRequest;
+import org.apache.servicecomb.governance.policy.FaultInjectionPolicy;
+import org.apache.servicecomb.governance.properties.FaultInjectionProperties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class FaultInjectionHandler extends AbstractGovernanceHandler<FaultInjectionPolicy, FaultInjectionPolicy> {
+ private static final Logger LOGGER = LoggerFactory.getLogger(FaultInjectionHandler.class);
+
+ @Autowired
+ private FaultInjectionProperties faultInjectionProperties;
+
+ @Override
+ protected String createKey(GovernanceRequest governanceRequest, FaultInjectionPolicy policy) {
+ return "servicecomb.faultInjection." + policy.getName();
+ }
+
+ @Override
+ public FaultInjectionPolicy matchPolicy(GovernanceRequest governanceRequest) {
+ return matchersManager.match(governanceRequest, faultInjectionProperties.getParsedEntity());
+ }
+
+ @Override
+ protected FaultInjectionPolicy createProcessor(String key, GovernanceRequest governanceRequest,
Review Comment:
Should here return Fault based on policy?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#discussion_r917588902
##########
governance/src/main/java/org/apache/servicecomb/injection/Fault.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.injection;
+
+import io.vavr.CheckedFunction0;
+
+public interface Fault {
+ static <T> CheckedFunction0<T> decorateCheckedSupplier(Fault fault, CheckedFunction0<T> supplier) {
+ return () -> {
+ try {
+ fault.injectFault();
+ } catch (FaultInjectionException exception) {
+ if (!exception.getFaultResponse().isDelay()) {
+ throw exception;
+ }
Review Comment:
This check is useless. DelayFault will not throw FaultInjectionException
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#discussion_r912589703
##########
governance/src/main/java/org/apache/servicecomb/governance/handler/FaultInjectionHandler.java:
##########
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.governance.handler;
+
+import org.apache.servicecomb.governance.marker.GovernanceRequest;
+import org.apache.servicecomb.governance.policy.FaultInjectionPolicy;
+import org.apache.servicecomb.governance.properties.FaultInjectionProperties;
+import org.apache.servicecomb.injection.Fault;
+import org.apache.servicecomb.injection.FaultInjectionUtil;
+
+public class FaultInjectionHandler extends AbstractGovernanceHandler<Fault, FaultInjectionPolicy> {
+
+ private FaultInjectionProperties faultInjectionProperties;
+
+ public FaultInjectionHandler(FaultInjectionProperties faultInjectionProperties) {
+ this.faultInjectionProperties = faultInjectionProperties;
+ }
+
+ @Override
+ protected String createKey(GovernanceRequest governanceRequest, FaultInjectionPolicy policy) {
+ return "servicecomb.faultInjection." + policy.getName();
Review Comment:
use constant `MATCH_FAULT_INJECTION_KEY` in properties class
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#discussion_r912592372
##########
governance/src/test/java/org/apache/servicecomb/governance/FlowControlTest.java:
##########
@@ -21,8 +21,10 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.servicecomb.governance.handler.FaultInjectionHandler;
Review Comment:
create tests in a new class, e.g. FaultInjectionHandlerTest
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [servicecomb-java-chassis] liubao68 commented on a diff in pull request #3140: [SCB-2330] add injectFault into governance
Posted by GitBox <gi...@apache.org>.
liubao68 commented on code in PR #3140:
URL: https://github.com/apache/servicecomb-java-chassis/pull/3140#discussion_r913677729
##########
governance/src/main/java/org/apache/servicecomb/governance/handler/FaultInjectionHandler.java:
##########
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.governance.handler;
+
+import org.apache.servicecomb.governance.marker.GovernanceRequest;
+import org.apache.servicecomb.governance.policy.FaultInjectionPolicy;
+import org.apache.servicecomb.governance.properties.FaultInjectionProperties;
+import org.apache.servicecomb.injection.Fault;
+import org.apache.servicecomb.injection.FaultInjectionUtil;
+
+public class FaultInjectionHandler extends AbstractGovernanceHandler<Fault, FaultInjectionPolicy> {
+
+ private FaultInjectionProperties faultInjectionProperties;
Review Comment:
This field can be final
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org