-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support dubbo3.x rateLimiting/circuitBreaker #1747
Open
chengyouling
wants to merge
1
commit into
sermant-io:develop
Choose a base branch
from
chengyouling:develop-rate
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+614
−6
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -530,6 +530,14 @@ runs: | |
id: changed-dubbo-common-action | ||
with: | ||
paths: ./.github/actions/scenarios/dubbo/dubbo-common ./.github/actions/common/dubbo ./.github/workflows/dubbo_integration_test.yml | ||
- uses: ktamas77/[email protected] | ||
id: changed-dubbo3-flow-action | ||
with: | ||
paths: ./.github/actions/scenarios/dubbo/flow-dubbo3 ./.github/actions/common/dubbo ./.github/workflows/dubbo_integration_test.yml | ||
- name: env dubbo3-flow-action | ||
shell: bash | ||
run: | | ||
echo "enableDubbo3FlowActionChange=${{ steps.changed-dubbo3-flow-action.outputs.changed }}" >> $GITHUB_ENV | ||
- name: env dubbo-router-action | ||
shell: bash | ||
run: | | ||
|
@@ -678,6 +686,13 @@ runs: | |
echo "enableDubboLane=true" >> $GITHUB_ENV | ||
echo "enableDubbo3Lane=true" >> $GITHUB_ENV | ||
fi | ||
# ==========dubbo3 flow is needed to test?========== | ||
if [ ${{ env.sermantAgentCoreChanged }} == 'true' -o ${{ env.sermantFlowcontrolChanged }} == 'true' -o \ | ||
${{ env.enableDubbo3FlowActionChange }} == 'true' -o \ | ||
${{ steps.changed-common-action.outputs.changed }} == 'true' -o ${{ env.triggerPushEvent }} == 'true' -o \ | ||
${{ env.enableDubboTestChange }} == 'true' ];then | ||
echo "enableDubbo3Flow=true" >> $GITHUB_ENV | ||
fi | ||
|
||
# *****************spring_integration_test_1.yml***************** | ||
# ==========graceful is needed to test?========== | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: "Dubbo3 Flow Test" | ||
description: "Auto test for dubbo3 flow" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: entry | ||
uses: ./.github/actions/common/entry | ||
with: | ||
log-dir: ./logs/dubbo3-flow | ||
- name: add load rule.yaml configuration for dubbo3 flow test | ||
shell: bash | ||
run: | | ||
mv -f sermant-integration-tests/dubbo-test/dubbo-2-7-integration-provider/src/main/java/io/sermant/integration/ProviderApplication.java sermant-integration-tests/dubbo-test/dubbo-2-7-integration-provider/src/main/java/io/sermant/integration/ProviderApplication.java.banck | ||
mv -f sermant-integration-tests/dubbo-test/dubbo-2-7-integration-provider/src/main/java/io/sermant/integration/Dubbo3ProviderApplication.java.banck sermant-integration-tests/dubbo-test/dubbo-2-7-integration-provider/src/main/java/io/sermant/integration/Dubbo3ProviderApplication.java | ||
- name: package dubbo 3.0.x tests | ||
shell: bash | ||
if: matrix.dubbo-version == '3-0' | ||
run: mvn package -Ddubbo.version=3.0.${{ matrix.dubbo-versions }} -DskipTests --file sermant-integration-tests/dubbo-test/pom.xml | ||
- name: package dubbo 3.1.x tests | ||
shell: bash | ||
if: matrix.dubbo-version == '3-1' | ||
run: mvn package -Ddubbo.version=3.1.${{ matrix.dubbo-versions }} -DskipTests --file sermant-integration-tests/dubbo-test/pom.xml | ||
- name: package dubbo 3.2.x tests | ||
shell: bash | ||
if: matrix.dubbo-version == '3-2' | ||
run: mvn package -Ddubbo.version=3.2.${{ matrix.dubbo-versions }} -DskipTests --file sermant-integration-tests/dubbo-test/pom.xml | ||
- name: start provider service | ||
shell: bash | ||
env: | ||
SERVER_PORT: 28022 | ||
DUBBO_PROTOCOL_PORT: 28822 | ||
run: | | ||
nohup java -javaagent:sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar=appName=dubbo-integration-provider -jar \ | ||
sermant-integration-tests/dubbo-test/dubbo-${{ env.projectPath }}-integration-provider/target/dubbo-integration-provider.jar > ${{ env.logDir }}/dubbo-provider.log 2>&1 & | ||
- name: waiting for providers start | ||
shell: bash | ||
run: | | ||
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:28022/actuator/health 120 | ||
- name: start consumer service | ||
shell: bash | ||
env: | ||
SERVER_PORT: 28020 | ||
DUBBO_PROTOCOL_PORT: 28820 | ||
run: | | ||
nohup java -javaagent:sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar=appName=dubbo-integration-consumer -jar \ | ||
sermant-integration-tests/dubbo-test/dubbo-${{ env.projectPath }}-integration-consumer/target/dubbo-integration-consumer.jar > ${{ env.logDir }}/dubbo-consumer.log 2>&1 & | ||
- name: waiting for consumers start | ||
shell: bash | ||
run: | | ||
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:28020/actuator/health 120 | ||
- name: integration test | ||
shell: bash | ||
env: | ||
TEST_TYPE: dubbo3-flow | ||
run: mvn test --file sermant-integration-tests/dubbo-test/pom.xml | ||
- name: reset Application file | ||
shell: bash | ||
run: | | ||
mv -f sermant-integration-tests/dubbo-test/dubbo-2-7-integration-provider/src/main/java/io/sermant/integration/ProviderApplication.java.banck sermant-integration-tests/dubbo-test/dubbo-2-7-integration-provider/src/main/java/io/sermant/integration/ProviderApplication.java | ||
mv -f sermant-integration-tests/dubbo-test/dubbo-2-7-integration-provider/src/main/java/io/sermant/integration/Dubbo3ProviderApplication.java sermant-integration-tests/dubbo-test/dubbo-2-7-integration-provider/src/main/java/io/sermant/integration/Dubbo3ProviderApplication.java.banck | ||
- name: mvn clean | ||
shell: bash | ||
run: mvn clean --file sermant-integration-tests/dubbo-test/pom.xml | ||
- name: exit | ||
if: always() | ||
uses: ./.github/actions/common/exit | ||
with: | ||
processor-keyword: dubbo | ||
- name: if failure then upload error log | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ failure() || cancelled() }} | ||
with: | ||
name: (test-for-dubbo3-flow)-(${{ matrix.dubbo-version }}-${{ matrix.dubbo-versions }})-logs | ||
path: | | ||
./*.log | ||
./logs/**/*.log | ||
if-no-files-found: warn | ||
retention-days: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...ration-provider/src/main/java/io/sermant/integration/Dubbo3ProviderApplication.java.banck
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (C) 2025-2025 Sermant Authors. All rights reserved. | ||
* | ||
* Licensed 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 io.sermant.integration; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.ComponentScan.Filter; | ||
import org.springframework.context.annotation.FilterType; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.context.annotation.ImportResource; | ||
|
||
import io.sermant.integration.configuration.FlowRuleConfiguration; | ||
import io.sermant.integration.controller.ConsumerController; | ||
import io.sermant.integration.controller.FlowController; | ||
|
||
/** | ||
* starter | ||
* | ||
* @author chengyouling | ||
* @since 2025-042-25 | ||
*/ | ||
@SpringBootApplication | ||
@ImportResource({"classpath:dubbo/provider.xml"}) | ||
@Import({FlowRuleConfiguration.class}) | ||
@ComponentScan(excludeFilters = @Filter(type = FilterType.ASSIGNABLE_TYPE, value = {ConsumerController.class, | ||
FlowController.class})) | ||
public class Dubbo3ProviderApplication { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(Dubbo3ProviderApplication.class); | ||
|
||
/** | ||
* spring starter | ||
* | ||
* @param args args | ||
*/ | ||
public static void main(String[] args) { | ||
LOGGER.info("====================start======================="); | ||
SpringApplication.run(Dubbo3ProviderApplication.class); | ||
LOGGER.info("=====================end========================"); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...vider/src/main/java/io/sermant/integration/configuration/FlowControlExceptionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (C) 2025-2025 Sermant Authors. All rights reserved. | ||
* | ||
* Licensed 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 io.sermant.integration.configuration; | ||
|
||
import io.sermant.integration.controller.FlowController; | ||
|
||
import org.apache.dubbo.rpc.RpcException; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ControllerAdvice; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
|
||
/** | ||
* global flow control exception handling | ||
* | ||
* @author chengyouling | ||
* @since 2025-02-22 | ||
*/ | ||
@ControllerAdvice(assignableTypes = {FlowController.class}) | ||
public class FlowControlExceptionHandler { | ||
/** | ||
* 异常处理 | ||
* | ||
* @param exception 异常 | ||
* @return 异常结果 | ||
*/ | ||
@ExceptionHandler(RpcException.class) | ||
public ResponseEntity<String> handleError(RpcException exception) { | ||
return new ResponseEntity<>(exception.getMessage(), HttpStatus.OK); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does Dubbo3ProviderApplication.java.banck mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To load the rule file only in the dubbo3 flow control scenario