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/09/14 14:02:29 UTC

[GitHub] [dubbo] jojocodeX opened a new pull request, #10622: metric add SPI [https://github.com/apache/dubbo/pull/10528]

jojocodeX opened a new pull request, #10622:
URL: https://github.com/apache/dubbo/pull/10622

   metric add spi


-- 
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] codecov-commenter commented on pull request #10622: metric add SPI

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

   # [Codecov](https://codecov.io/gh/apache/dubbo/pull/10622?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 [#10622](https://codecov.io/gh/apache/dubbo/pull/10622?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1813639) into [3.1](https://codecov.io/gh/apache/dubbo/commit/ddd1786578438c68f1f6214bcab600a299245d7d?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ddd1786) will **decrease** coverage by `0.35%`.
   > The diff coverage is `88.48%`.
   
   > :exclamation: Current head 1813639 differs from pull request most recent head f5473f0. Consider uploading reports for the commit f5473f0 to get more accurate results
   
   ```diff
   @@             Coverage Diff              @@
   ##                3.1   #10622      +/-   ##
   ============================================
   - Coverage     65.16%   64.81%   -0.36%     
   + Complexity      493      430      -63     
   ============================================
     Files          1336     1340       +4     
     Lines         56874    56994     +120     
     Branches       8421     8406      -15     
   ============================================
   - Hits          37063    36938     -125     
   - Misses        15842    16054     +212     
   - Partials       3969     4002      +33     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo/pull/10622?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...apache/dubbo/common/constants/CommonConstants.java](https://codecov.io/gh/apache/dubbo/pull/10622/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-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vY29uc3RhbnRzL0NvbW1vbkNvbnN0YW50cy5qYXZh) | `100.00% <ø> (ø)` | |
   | [...org/apache/dubbo/metrics/filter/MetricsFilter.java](https://codecov.io/gh/apache/dubbo/pull/10622/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-ZHViYm8tbWV0cmljcy9kdWJiby1tZXRyaWNzLWFwaS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vbWV0cmljcy9maWx0ZXIvTWV0cmljc0ZpbHRlci5qYXZh) | `83.33% <0.00%> (-10.42%)` | :arrow_down: |
   | [...e/dubbo/metrics/service/DefaultMetricsService.java](https://codecov.io/gh/apache/dubbo/pull/10622/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-ZHViYm8tbWV0cmljcy9kdWJiby1tZXRyaWNzLWFwaS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vbWV0cmljcy9zZXJ2aWNlL0RlZmF1bHRNZXRyaWNzU2VydmljZS5qYXZh) | `0.00% <ø> (ø)` | |
   | [.../config/metrics/DefaultMetricsServiceExporter.java](https://codecov.io/gh/apache/dubbo/pull/10622/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-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9tZXRyaWNzL0RlZmF1bHRNZXRyaWNzU2VydmljZUV4cG9ydGVyLmphdmE=) | `80.55% <80.55%> (ø)` | |
   | [...bootstrap/builders/ExportServiceConfigBuilder.java](https://codecov.io/gh/apache/dubbo/pull/10622/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-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9ib290c3RyYXAvYnVpbGRlcnMvRXhwb3J0U2VydmljZUNvbmZpZ0J1aWxkZXIuamF2YQ==) | `91.01% <91.01%> (ø)` | |
   | [...ubbo/config/deploy/DefaultApplicationDeployer.java](https://codecov.io/gh/apache/dubbo/pull/10622/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-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9kZXBsb3kvRGVmYXVsdEFwcGxpY2F0aW9uRGVwbG95ZXIuamF2YQ==) | `72.91% <91.66%> (+0.44%)` | :arrow_up: |
   | [...ava/org/apache/dubbo/config/ApplicationConfig.java](https://codecov.io/gh/apache/dubbo/pull/10622/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-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb25maWcvQXBwbGljYXRpb25Db25maWcuamF2YQ==) | `85.71% <100.00%> (+0.52%)` | :arrow_up: |
   | [.../metadata/ConfigurableMetadataServiceExporter.java](https://codecov.io/gh/apache/dubbo/pull/10622/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-ZHViYm8tY29uZmlnL2R1YmJvLWNvbmZpZy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL2NvbmZpZy9tZXRhZGF0YS9Db25maWd1cmFibGVNZXRhZGF0YVNlcnZpY2VFeHBvcnRlci5qYXZh) | `67.56% <100.00%> (-10.79%)` | :arrow_down: |
   | [...mmon/serialize/fastjson2/FastJson2ObjectInput.java](https://codecov.io/gh/apache/dubbo/pull/10622/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-ZHViYm8tc2VyaWFsaXphdGlvbi9kdWJiby1zZXJpYWxpemF0aW9uLWZhc3Rqc29uMi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vY29tbW9uL3NlcmlhbGl6ZS9mYXN0anNvbjIvRmFzdEpzb24yT2JqZWN0SW5wdXQuamF2YQ==) | `0.00% <0.00%> (-62.50%)` | :arrow_down: |
   | [...mon/serialize/fastjson2/FastJson2ObjectOutput.java](https://codecov.io/gh/apache/dubbo/pull/10622/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-ZHViYm8tc2VyaWFsaXphdGlvbi9kdWJiby1zZXJpYWxpemF0aW9uLWZhc3Rqc29uMi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vY29tbW9uL3NlcmlhbGl6ZS9mYXN0anNvbjIvRmFzdEpzb24yT2JqZWN0T3V0cHV0LmphdmE=) | `0.00% <0.00%> (-56.25%)` | :arrow_down: |
   | ... and [75 more](https://codecov.io/gh/apache/dubbo/pull/10622/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] jojocodeX commented on a diff in pull request #10622: metric add SPI

Posted by GitBox <gi...@apache.org>.
jojocodeX commented on code in PR #10622:
URL: https://github.com/apache/dubbo/pull/10622#discussion_r981860420


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/builders/ExportServiceConfigBuilder.java:
##########
@@ -0,0 +1,212 @@
+/*
+ * 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.config.bootstrap.builders;
+
+import static org.apache.dubbo.common.constants.CommonConstants.CORE_THREADS_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_PROTOCOL;
+import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.THREADS_KEY;
+import static org.apache.dubbo.remoting.Constants.BIND_PORT_KEY;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.function.Consumer;
+
+import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.common.utils.Assert;
+import org.apache.dubbo.common.utils.CollectionUtils;
+import org.apache.dubbo.common.utils.StringUtils;
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ProtocolConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.config.ServiceConfig;
+import org.apache.dubbo.rpc.Protocol;
+import org.apache.dubbo.rpc.ProtocolServer;
+import org.apache.dubbo.rpc.model.ApplicationModel;
+
+public class ExportServiceConfigBuilder<T> {

Review Comment:
   现在提供在api这一层,考虑到复用性,这个类放到commons包里面,这样的调整是否合适



-- 
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] jojocodeX commented on pull request #10622: metric add SPI

Posted by GitBox <gi...@apache.org>.
jojocodeX commented on PR #10622:
URL: https://github.com/apache/dubbo/pull/10622#issuecomment-1260869522

   已处理


-- 
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] jojocodeX commented on a diff in pull request #10622: metric add SPI

Posted by GitBox <gi...@apache.org>.
jojocodeX commented on code in PR #10622:
URL: https://github.com/apache/dubbo/pull/10622#discussion_r982131430


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/metadata/ConfigurableMetadataServiceExporter.java:
##########
@@ -68,9 +54,17 @@ public ConfigurableMetadataServiceExporter(ApplicationModel applicationModel, Me
 
     public synchronized ConfigurableMetadataServiceExporter export() {
         if (serviceConfig == null || !isExported()) {
-            this.serviceConfig = buildServiceConfig();
+            this.serviceConfig = InternalServiceConfigBuilder.<MetadataService>newBuilder(applicationModel)
+                .interfaceClass(MetadataService.class)
+                .protocol(getApplicationConfig().getMetadataServiceProtocol(), METADATA_SERVICE_PROTOCOL_KEY)
+                .port(getApplicationConfig().getMetadataServicePort(), METADATA_SERVICE_PORT_KEY)
+                .registryId("internal-metadata-registry")
+                .ref(metadataService)
+                .build(configConsumer -> configConsumer.setMethods(generateMethodConfig()));

Review Comment:
   这个逻辑是以往就存在的逻辑,MetricsService也需要导出服务,在导出的时候有许多共性的特征,所以对当前代码进行了抽取。之所以会声明,服务发现的过程中,方法内部在获取实例服务时会调用些方法进行变更操作。在真正导出时,对于这种特殊的方法,并没有统一处理,我理解应该是为了解决此问题,才会进行声明式设置



-- 
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] chickenlj commented on a diff in pull request #10622: metric add SPI

Posted by GitBox <gi...@apache.org>.
chickenlj commented on code in PR #10622:
URL: https://github.com/apache/dubbo/pull/10622#discussion_r982168979


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/metadata/ConfigurableMetadataServiceExporter.java:
##########
@@ -68,9 +54,17 @@ public ConfigurableMetadataServiceExporter(ApplicationModel applicationModel, Me
 
     public synchronized ConfigurableMetadataServiceExporter export() {
         if (serviceConfig == null || !isExported()) {
-            this.serviceConfig = buildServiceConfig();
+            this.serviceConfig = InternalServiceConfigBuilder.<MetadataService>newBuilder(applicationModel)
+                .interfaceClass(MetadataService.class)
+                .protocol(getApplicationConfig().getMetadataServiceProtocol(), METADATA_SERVICE_PROTOCOL_KEY)
+                .port(getApplicationConfig().getMetadataServicePort(), METADATA_SERVICE_PORT_KEY)
+                .registryId("internal-metadata-registry")
+                .ref(metadataService)
+                .build(configConsumer -> configConsumer.setMethods(generateMethodConfig()));

Review Comment:
   MethodConfig generated can be different per use case, so better be customizable for each call.



-- 
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] CrazyHZM commented on a diff in pull request #10622: metric add SPI

Posted by GitBox <gi...@apache.org>.
CrazyHZM commented on code in PR #10622:
URL: https://github.com/apache/dubbo/pull/10622#discussion_r981157645


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/builders/ExportServiceConfigBuilder.java:
##########
@@ -0,0 +1,212 @@
+/*
+ * 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.config.bootstrap.builders;
+
+import static org.apache.dubbo.common.constants.CommonConstants.CORE_THREADS_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_PROTOCOL;
+import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.THREADS_KEY;
+import static org.apache.dubbo.remoting.Constants.BIND_PORT_KEY;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.function.Consumer;
+
+import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.common.utils.Assert;
+import org.apache.dubbo.common.utils.CollectionUtils;
+import org.apache.dubbo.common.utils.StringUtils;
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ProtocolConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.config.ServiceConfig;
+import org.apache.dubbo.rpc.Protocol;
+import org.apache.dubbo.rpc.ProtocolServer;
+import org.apache.dubbo.rpc.model.ApplicationModel;
+
+public class ExportServiceConfigBuilder<T> {

Review Comment:
   More worried about the abuse of `ExportServiceConfigBuilder`. Are we thinking about opening this API to the public?



-- 
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] chickenlj commented on pull request #10622: metric add SPI

Posted by GitBox <gi...@apache.org>.
chickenlj commented on PR #10622:
URL: https://github.com/apache/dubbo/pull/10622#issuecomment-1260518844

   Can you please explain the design of the configuration of the metrics-related properties, I noticed there are metrics properties defined in both ApplicationConfig and MetricsConfig, when should we need to set properties in ApplicationConfig and when should we set MetricsConfig? 


-- 
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] AlbumenJ commented on a diff in pull request #10622: metric add SPI

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on code in PR #10622:
URL: https://github.com/apache/dubbo/pull/10622#discussion_r971584518


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/metrics/DefaultMetricsServiceExporter.java:
##########
@@ -0,0 +1,107 @@
+package org.apache.dubbo.config.metrics;

Review Comment:
   Please add ASF license header



-- 
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] chickenlj commented on a diff in pull request #10622: metric add SPI

Posted by GitBox <gi...@apache.org>.
chickenlj commented on code in PR #10622:
URL: https://github.com/apache/dubbo/pull/10622#discussion_r982047309


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/metadata/ConfigurableMetadataServiceExporter.java:
##########
@@ -68,9 +54,17 @@ public ConfigurableMetadataServiceExporter(ApplicationModel applicationModel, Me
 
     public synchronized ConfigurableMetadataServiceExporter export() {
         if (serviceConfig == null || !isExported()) {
-            this.serviceConfig = buildServiceConfig();
+            this.serviceConfig = InternalServiceConfigBuilder.<MetadataService>newBuilder(applicationModel)
+                .interfaceClass(MetadataService.class)
+                .protocol(getApplicationConfig().getMetadataServiceProtocol(), METADATA_SERVICE_PROTOCOL_KEY)
+                .port(getApplicationConfig().getMetadataServicePort(), METADATA_SERVICE_PORT_KEY)
+                .registryId("internal-metadata-registry")
+                .ref(metadataService)
+                .build(configConsumer -> configConsumer.setMethods(generateMethodConfig()));

Review Comment:
   Why do methods need to be treated differently? Could we achieve the same purpose by adding a `methods` method in the ServiceConfig Builder?



-- 
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] jojocodeX commented on a diff in pull request #10622: metric add SPI

Posted by GitBox <gi...@apache.org>.
jojocodeX commented on code in PR #10622:
URL: https://github.com/apache/dubbo/pull/10622#discussion_r981860420


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/builders/ExportServiceConfigBuilder.java:
##########
@@ -0,0 +1,212 @@
+/*
+ * 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.config.bootstrap.builders;
+
+import static org.apache.dubbo.common.constants.CommonConstants.CORE_THREADS_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_PROTOCOL;
+import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.THREADS_KEY;
+import static org.apache.dubbo.remoting.Constants.BIND_PORT_KEY;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.function.Consumer;
+
+import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.common.utils.Assert;
+import org.apache.dubbo.common.utils.CollectionUtils;
+import org.apache.dubbo.common.utils.StringUtils;
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ProtocolConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.config.ServiceConfig;
+import org.apache.dubbo.rpc.Protocol;
+import org.apache.dubbo.rpc.ProtocolServer;
+import org.apache.dubbo.rpc.model.ApplicationModel;
+
+public class ExportServiceConfigBuilder<T> {

Review Comment:
   现在提供在api这一层,考虑到复用性,这个类放到commons包里面,这样的调整是否合适



-- 
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] chickenlj commented on pull request #10622: metric add SPI

Posted by GitBox <gi...@apache.org>.
chickenlj commented on PR #10622:
URL: https://github.com/apache/dubbo/pull/10622#issuecomment-1260637874

   > 
   
   后续最好能将所有配置统一到 MetricsConfig 中进行配置


-- 
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] AlbumenJ commented on a diff in pull request #10622: metric add SPI

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on code in PR #10622:
URL: https://github.com/apache/dubbo/pull/10622#discussion_r981969735


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/builders/InternalServiceConfigBuilder.java:
##########
@@ -0,0 +1,210 @@
+/*
+ * 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.config.bootstrap.builders;
+
+import static org.apache.dubbo.common.constants.CommonConstants.CORE_THREADS_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_PROTOCOL;
+import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.THREADS_KEY;
+import static org.apache.dubbo.remoting.Constants.BIND_PORT_KEY;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.function.Consumer;
+
+import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.common.utils.Assert;
+import org.apache.dubbo.common.utils.CollectionUtils;
+import org.apache.dubbo.common.utils.StringUtils;
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ProtocolConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.config.ServiceConfig;
+import org.apache.dubbo.rpc.Protocol;
+import org.apache.dubbo.rpc.ProtocolServer;
+import org.apache.dubbo.rpc.model.ApplicationModel;
+
+public class InternalServiceConfigBuilder<T> {
+
+    private final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(getClass());
+
+    private final ApplicationModel applicationModel;
+    private String  protocol;
+    private Integer port;
+    private String registryId;
+    private Class<T> interfaceClass;
+    private T   ref;
+
+    private InternalServiceConfigBuilder(ApplicationModel applicationModel) {
+        this.applicationModel = applicationModel;
+    }
+
+    public static <T> InternalServiceConfigBuilder<T> newBuilder(ApplicationModel applicationModel) {
+        return new InternalServiceConfigBuilder<>(applicationModel);
+    }
+
+
+
+    public InternalServiceConfigBuilder<T> interfaceClass(Class<T> interfaceClass) {
+        this.interfaceClass = interfaceClass;
+        return getThis();
+    }
+
+    public InternalServiceConfigBuilder<T> ref(T ref) {
+        this.ref = ref;
+        return getThis();
+    }
+
+    public InternalServiceConfigBuilder<T> registryId(String registryId) {
+        this.registryId = registryId;
+        return getThis();
+    }
+    
+    public InternalServiceConfigBuilder<T> protocol(String protocol, String key) {
+        if (StringUtils.isEmpty(protocol)) {
+            Map<String, String> params = getApplicationConfig().getParameters();
+            if (CollectionUtils.isNotEmptyMap(params)) {
+                protocol = getApplicationConfig().getParameters().get(key);
+            }
+        }
+        this.protocol = StringUtils.isNotEmpty(protocol) ? protocol : DUBBO_PROTOCOL;
+
+        return getThis();
+    }
+
+    public InternalServiceConfigBuilder<T> port(Integer specPort, String key) {
+        Assert.notEmptyString(this.protocol,"export protocol is null");
+        Assert.notNull(this.interfaceClass,"export interfaceClass is null");
+
+        if (specPort != null) {
+            this.port = specPort;
+            return getThis();
+        }
+        Map<String, String> params = getApplicationConfig().getParameters();
+        if (CollectionUtils.isNotEmptyMap(params)) {
+            String rawPort = getApplicationConfig().getParameters().get(key);
+            if (StringUtils.isNotEmpty(rawPort)) {
+                specPort = Integer.parseInt(rawPort);
+            }
+        }
+
+        if (specPort == null || specPort < -1) {
+            try {
+                if (logger.isInfoEnabled()) {
+                    logger.info(interfaceClass.getName()+"Service Port hasn't been set will use default protocol defined in protocols.");
+                }
+
+                Protocol protocol = applicationModel.getExtensionLoader(Protocol.class).getExtension(this.protocol);
+                if (protocol != null && protocol.getServers() != null) {
+                    Iterator<ProtocolServer> it = protocol.getServers().iterator();
+                    // export service may export before normal service export, it.hasNext() will return false.
+                    // so need use specified protocol port.
+                    if (it.hasNext()) {
+                        ProtocolServer server = it.next();
+                        String rawPort = server.getUrl().getParameter(BIND_PORT_KEY);
+                        if (rawPort == null) {
+                            String addr = server.getAddress();
+                            rawPort = addr.substring(addr.indexOf(":") + 1);
+                        }
+                        this.port = Integer.parseInt(rawPort);
+                    } else {
+                        Integer protocolPort = getProtocolConfig().getPort();
+                        if (null != protocolPort && protocolPort != -1) {
+                            this.port = protocolPort;
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                logger.error("5-16", "invalid specified " + protocol + "  protocol", "", "Failed to find any valid protocol, will use random port to export metadata service.");

Review Comment:
   log out `e`



-- 
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] jojocodeX commented on pull request #10622: metric add SPI

Posted by GitBox <gi...@apache.org>.
jojocodeX commented on PR #10622:
URL: https://github.com/apache/dubbo/pull/10622#issuecomment-1260623654

   metricsConfig中的协议,只是一种实现方式的声明,比如声明为 prometheus,而内部导出的服务,以什么样的形式提供调用,允许定义不同的协议调用方法


-- 
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] AlbumenJ merged pull request #10622: metric add SPI

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


-- 
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] jojocodeX commented on a diff in pull request #10622: metric add SPI

Posted by GitBox <gi...@apache.org>.
jojocodeX commented on code in PR #10622:
URL: https://github.com/apache/dubbo/pull/10622#discussion_r981949085


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/bootstrap/builders/ExportServiceConfigBuilder.java:
##########
@@ -0,0 +1,212 @@
+/*
+ * 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.config.bootstrap.builders;
+
+import static org.apache.dubbo.common.constants.CommonConstants.CORE_THREADS_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_PROTOCOL;
+import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.THREADS_KEY;
+import static org.apache.dubbo.remoting.Constants.BIND_PORT_KEY;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.function.Consumer;
+
+import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.common.utils.Assert;
+import org.apache.dubbo.common.utils.CollectionUtils;
+import org.apache.dubbo.common.utils.StringUtils;
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ProtocolConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.config.ServiceConfig;
+import org.apache.dubbo.rpc.Protocol;
+import org.apache.dubbo.rpc.ProtocolServer;
+import org.apache.dubbo.rpc.model.ApplicationModel;
+
+public class ExportServiceConfigBuilder<T> {

Review Comment:
   考虑到当前这个类只提供内部使用,对命名进行了一定调整



-- 
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