You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/12/10 07:30:47 UTC

[GitHub] [dubbo-spi-extensions] andrewshan opened a new pull request, #184: Add polaris extensions support

andrewshan opened a new pull request, #184:
URL: https://github.com/apache/dubbo-spi-extensions/pull/184

   ## What is the purpose of the change
   
   Add the polaris extensions to make dubbo2.7.x access polaris
   
   ## Brief changelog
   
   #91 
   
   ## Verifying this change
   
   Follow this checklist to help us incorporate your contribution quickly and easily:
   
   - [x] Make sure there is a [GITHUB_issue](https://github.com/apache/dubbo/issues) field for the change (usually before
     you start working on it). Trivial changes like typos do not require a GITHUB issue. Your pull request should address
     just this issue, without pulling in other changes - one PR resolves one issue.
   - [ ] Format the pull request title like `[Dubbo-XXX] Fix UnknownException when host config not exist #XXX`. Each commit
     in the pull request should have a meaningful subject line and body.
   - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [ ] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency
     exist. If the new feature or significant change is committed, please remember to add sample
     in [dubbo samples](https://github.com/apache/dubbo-samples) project.
   - [ ] Run `mvn clean install -DskipTests=false` & `mvn clean test-compile failsafe:integration-test` to make sure
     unit-test and integration-test pass.
   - [ ] If this contribution is large, please follow
     the [Software Donation Guide](https://github.com/apache/dubbo/wiki/Software-donation-guide).
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-spi-extensions] AlbumenJ commented on a diff in pull request #184: Add polaris extensions support

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on code in PR #184:
URL: https://github.com/apache/dubbo-spi-extensions/pull/184#discussion_r1046747477


##########
dubbo-cluster-extensions/dubbo-cluster-polaris-dubbo2/pom.xml:
##########
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>dubbo-cluster-extensions</artifactId>
+        <groupId>org.apache.dubbo.extensions</groupId>
+        <version>${revision}</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>dubbo-cluster-polaris-dubbo2</artifactId>

Review Comment:
   > all other polaris plugins specific this version?
   
   yes



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-spi-extensions] andrewshan commented on a diff in pull request #184: Add polaris extensions support

Posted by GitBox <gi...@apache.org>.
andrewshan commented on code in PR #184:
URL: https://github.com/apache/dubbo-spi-extensions/pull/184#discussion_r1046599954


##########
dubbo-cluster-extensions/dubbo-cluster-polaris-dubbo2/pom.xml:
##########
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>dubbo-cluster-extensions</artifactId>
+        <groupId>org.apache.dubbo.extensions</groupId>
+        <version>${revision}</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>dubbo-cluster-polaris-dubbo2</artifactId>

Review Comment:
   all other polaris plugins specific this version?



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-spi-extensions] codecov-commenter commented on pull request #184: Add polaris extensions support

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #184:
URL: https://github.com/apache/dubbo-spi-extensions/pull/184#issuecomment-1345430787

   # [Codecov](https://codecov.io/gh/apache/dubbo-spi-extensions/pull/184?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 [#184](https://codecov.io/gh/apache/dubbo-spi-extensions/pull/184?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6ff7e21) into [master](https://codecov.io/gh/apache/dubbo-spi-extensions/commit/9312264235fd906d7a5b7a150ae3731b3dcfd82b?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9312264) will **increase** coverage by `1.84%`.
   > The diff coverage is `n/a`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master     #184      +/-   ##
   ============================================
   + Coverage     34.27%   36.12%   +1.84%     
   - Complexity      516      555      +39     
   ============================================
     Files           151      159       +8     
     Lines          5313     5620     +307     
     Branches        657      691      +34     
   ============================================
   + Hits           1821     2030     +209     
   - Misses         3292     3353      +61     
   - Partials        200      237      +37     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-spi-extensions/pull/184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...g/p2p/exchange/support/MulticastExchangeGroup.java](https://codecov.io/gh/apache/dubbo-spi-extensions/pull/184/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-ZHViYm8tc3BpLWV4dGVuc2lvbnMvZHViYm8tcmVtb3RpbmctZXh0ZW5zaW9ucy9kdWJiby1yZW1vdGluZy1wMnAvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL3JlbW90aW5nL3AycC9leGNoYW5nZS9zdXBwb3J0L011bHRpY2FzdEV4Y2hhbmdlR3JvdXAuamF2YQ==) | `77.50% <0.00%> (-5.00%)` | :arrow_down: |
   | [...ache/dubbo/remoting/transport/mina/MinaClient.java](https://codecov.io/gh/apache/dubbo-spi-extensions/pull/184/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-ZHViYm8tc3BpLWV4dGVuc2lvbnMvZHViYm8tcmVtb3RpbmctZXh0ZW5zaW9ucy9kdWJiby1yZW1vdGluZy1taW5hL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy90cmFuc3BvcnQvbWluYS9NaW5hQ2xpZW50LmphdmE=) | `56.92% <0.00%> (-1.54%)` | :arrow_down: |
   | [...org/apache/dubbo/registry/redis/RedisRegistry.java](https://codecov.io/gh/apache/dubbo-spi-extensions/pull/184/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-ZHViYm8tc3BpLWV4dGVuc2lvbnMvZHViYm8tcmVnaXN0cnktZXh0ZW5zaW9ucy9kdWJiby1yZWdpc3RyeS1yZWRpcy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcmVnaXN0cnkvcmVkaXMvUmVkaXNSZWdpc3RyeS5qYXZh) | `53.18% <0.00%> (-1.50%)` | :arrow_down: |
   | [...ata/SeataTransactionPropagationProviderFilter.java](https://codecov.io/gh/apache/dubbo-spi-extensions/pull/184/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-ZHViYm8tc3BpLWV4dGVuc2lvbnMvZHViYm8tZmlsdGVyLWV4dGVuc2lvbnMvZHViYm8tZmlsdGVyLXNlYXRhL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9zZWF0YS9TZWF0YVRyYW5zYWN0aW9uUHJvcGFnYXRpb25Qcm92aWRlckZpbHRlci5qYXZh) | `76.47% <0.00%> (-0.68%)` | :arrow_down: |
   | [...a/org/apache/dubbo/registry/etcd/EtcdRegistry.java](https://codecov.io/gh/apache/dubbo-spi-extensions/pull/184/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-ZHViYm8tc3BpLWV4dGVuc2lvbnMvZHViYm8tcmVnaXN0cnktZXh0ZW5zaW9ucy9kdWJiby1yZWdpc3RyeS1ldGNkMy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcmVnaXN0cnkvZXRjZC9FdGNkUmVnaXN0cnkuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...ache/dubbo/registry/etcd/EtcdServiceDiscovery.java](https://codecov.io/gh/apache/dubbo-spi-extensions/pull/184/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-ZHViYm8tc3BpLWV4dGVuc2lvbnMvZHViYm8tcmVnaXN0cnktZXh0ZW5zaW9ucy9kdWJiby1yZWdpc3RyeS1ldGNkMy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcmVnaXN0cnkvZXRjZC9FdGNkU2VydmljZURpc2NvdmVyeS5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [.../dubbo/remoting/etcd/jetcd/JEtcdClientWrapper.java](https://codecov.io/gh/apache/dubbo-spi-extensions/pull/184/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-ZHViYm8tc3BpLWV4dGVuc2lvbnMvZHViYm8tcmVtb3RpbmctZXh0ZW5zaW9ucy9kdWJiby1yZW1vdGluZy1ldGNkMy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vcmVtb3RpbmcvZXRjZC9qZXRjZC9KRXRjZENsaWVudFdyYXBwZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...gistry/polaris/PolarisServiceDiscoveryFactory.java](https://codecov.io/gh/apache/dubbo-spi-extensions/pull/184/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-ZHViYm8tc3BpLWV4dGVuc2lvbnMvZHViYm8tcmVnaXN0cnktZXh0ZW5zaW9ucy9kdWJiby1yZWdpc3RyeS1wb2xhcmlzL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZWdpc3RyeS9wb2xhcmlzL1BvbGFyaXNTZXJ2aWNlRGlzY292ZXJ5RmFjdG9yeS5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...dubbo/registry/polaris/PolarisRegistryFactory.java](https://codecov.io/gh/apache/dubbo-spi-extensions/pull/184/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-ZHViYm8tc3BpLWV4dGVuc2lvbnMvZHViYm8tcmVnaXN0cnktZXh0ZW5zaW9ucy9kdWJiby1yZWdpc3RyeS1wb2xhcmlzL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZWdpc3RyeS9wb2xhcmlzL1BvbGFyaXNSZWdpc3RyeUZhY3RvcnkuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...apache/dubbo/registry/polaris/PolarisRegistry.java](https://codecov.io/gh/apache/dubbo-spi-extensions/pull/184/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-ZHViYm8tc3BpLWV4dGVuc2lvbnMvZHViYm8tcmVnaXN0cnktZXh0ZW5zaW9ucy9kdWJiby1yZWdpc3RyeS1wb2xhcmlzL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZWdpc3RyeS9wb2xhcmlzL1BvbGFyaXNSZWdpc3RyeS5qYXZh) | `64.22% <0.00%> (ø)` | |
   | ... and [5 more](https://codecov.io/gh/apache/dubbo-spi-extensions/pull/184/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) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-spi-extensions] AlbumenJ merged pull request #184: Add polaris extensions support

Posted by GitBox <gi...@apache.org>.
AlbumenJ merged PR #184:
URL: https://github.com/apache/dubbo-spi-extensions/pull/184


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-spi-extensions] AlbumenJ commented on a diff in pull request #184: Add polaris extensions support

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on code in PR #184:
URL: https://github.com/apache/dubbo-spi-extensions/pull/184#discussion_r1045453963


##########
dubbo-cluster-extensions/dubbo-cluster-polaris-dubbo2/pom.xml:
##########
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>dubbo-cluster-extensions</artifactId>
+        <groupId>org.apache.dubbo.extensions</groupId>
+        <version>${revision}</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>dubbo-cluster-polaris-dubbo2</artifactId>

Review Comment:
   `<verrsion>1.0.0-SNAPSHOT</version>`



##########
dubbo-filter-extensions/dubbo-filter-polaris-dubbo2/src/main/java/org/apache/dubbo/filter/dubbo2/RateLimitFilter.java:
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.dubbo.filter.dubbo2;
+
+import com.tencent.polaris.api.pojo.ServiceEventKey.EventType;
+import com.tencent.polaris.api.pojo.ServiceRule;
+import com.tencent.polaris.api.utils.StringUtils;
+import com.tencent.polaris.client.pb.ModelProto.MatchArgument;
+import com.tencent.polaris.client.pb.RateLimitProto.RateLimit;
+import com.tencent.polaris.common.exception.PolarisBlockException;
+import com.tencent.polaris.common.registry.PolarisOperator;
+import com.tencent.polaris.common.registry.PolarisOperatorDelegate;
+import com.tencent.polaris.common.router.ObjectParser;
+import com.tencent.polaris.common.router.RuleHandler;
+import com.tencent.polaris.ratelimit.api.rpc.Argument;
+import com.tencent.polaris.ratelimit.api.rpc.QuotaResponse;
+import com.tencent.polaris.ratelimit.api.rpc.QuotaResultCode;
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.dubbo.common.constants.CommonConstants;
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.common.logger.Logger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.rpc.Filter;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.Result;
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.rpc.RpcException;
+
+@Activate(group = CommonConstants.PROVIDER)
+public class RateLimitFilter extends PolarisOperatorDelegate implements Filter {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(RateLimitFilter.class);
+
+    private final RuleHandler ruleHandler;
+
+    public RateLimitFilter() {
+        LOGGER.info("[POLARIS] init polaris ratelimit");
+        ruleHandler = new RuleHandler();
+    }
+
+    @Override
+    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
+        String service = invoker.getInterface().getName();
+        PolarisOperator polarisOperator = getPolarisOperator();
+        if (null == polarisOperator) {
+            return invoker.invoke(invocation);
+        }
+        ServiceRule serviceRule = polarisOperator.getServiceRule(service, EventType.RATE_LIMITING);
+        Object ruleObject = serviceRule.getRule();
+        if (null == ruleObject) {
+            return invoker.invoke(invocation);
+        }
+        RateLimit rateLimit = (RateLimit) ruleObject;
+        Set<MatchArgument> ratelimitLabels = ruleHandler.getRatelimitLabels(rateLimit);
+        String method = invocation.getMethodName();
+        Set<Argument> arguments = new HashSet<>();
+        for (MatchArgument matchArgument : ratelimitLabels) {
+            switch (matchArgument.getType()) {
+                case HEADER:
+                    String attachmentValue = RpcContext.getContext().getAttachment(matchArgument.getKey());
+                    if (!StringUtils.isBlank(attachmentValue)) {
+                        arguments.add(Argument.buildHeader(matchArgument.getKey(), attachmentValue));
+                    }
+                    break;
+                case QUERY:
+                    Object queryValue = ObjectParser
+                            .parseArgumentsByExpression(matchArgument.getKey(), invocation.getArguments());
+                    if (null != queryValue) {
+                        arguments.add(Argument
+                                .buildQuery(matchArgument.getKey(), String.valueOf(queryValue)));
+                    }
+                    break;
+                default:
+                    break;
+            }
+        }
+        QuotaResponse quotaResponse = null;
+        try {
+            quotaResponse = polarisOperator.getQuota(service, method, arguments);
+        } catch (RuntimeException e) {
+            LOGGER.error("[POLARIS] get quota fail", e);
+        }
+        if (null != quotaResponse && quotaResponse.getCode() == QuotaResultCode.QuotaResultLimited) {
+            // 请求被限流,则抛出异常

Review Comment:
   Please comment in English



##########
dubbo-filter-extensions/dubbo-filter-polaris-dubbo2/src/main/java/org/apache/dubbo/filter/dubbo2/ReportFilter.java:
##########
@@ -0,0 +1,90 @@
+/*
+ * 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.dubbo.filter.dubbo2;
+
+
+import com.tencent.polaris.api.pojo.RetStatus;
+import com.tencent.polaris.common.registry.PolarisOperator;
+import com.tencent.polaris.common.registry.PolarisOperatorDelegate;
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.constants.CommonConstants;
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.common.logger.Logger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.rpc.Filter;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.Result;
+import org.apache.dubbo.rpc.RpcException;
+
+@Activate(group = CommonConstants.CONSUMER)
+public class ReportFilter extends PolarisOperatorDelegate implements Filter {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(ReportFilter.class);
+
+    public ReportFilter() {
+        LOGGER.info("[POLARIS] init polaris reporter");
+    }
+
+    @Override
+    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
+        long startTimeMilli = System.currentTimeMillis();
+        Result result = null;
+        Throwable exception = null;
+        RpcException rpcException = null;
+        try {
+            result = invoker.invoke(invocation);
+        } catch (Throwable e) {
+            exception = e;
+        }
+        if (null != result && result.hasException()) {
+            exception = result.getException();
+        }
+        if (exception instanceof RpcException) {
+            rpcException = (RpcException) exception;
+        }
+        PolarisOperator polarisOperator = getPolarisOperator();
+        if (null == polarisOperator) {
+            return result;
+        }
+        RetStatus retStatus = RetStatus.RetSuccess;
+        int code = 0;
+        if (null != exception) {
+            retStatus = RetStatus.RetFail;
+            if (null != rpcException) {
+                code = rpcException.getCode();
+                if (code == RpcException.LIMIT_EXCEEDED_EXCEPTION) {
+                    // 限流异常不进行熔断

Review Comment:
   Please comment in English



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org