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 2021/10/26 08:25:13 UTC
[GitHub] [servicecomb-java-chassis] five111 opened a new pull request #2626: Optimize the ping method
five111 opened a new pull request #2626:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2626
When there are multiple endpoints, ping only the first one may cause the available services to be defined as unavailable
#2624
--
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] five111 commented on a change in pull request #2626: [SCB-2351] Optimize the ping method
Posted by GitBox <gi...@apache.org>.
five111 commented on a change in pull request #2626:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2626#discussion_r737163734
##########
File path: foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/SimpleMicroserviceInstancePing.java
##########
@@ -23,27 +23,34 @@
import org.apache.servicecomb.foundation.common.net.IpPort;
import org.apache.servicecomb.foundation.common.net.NetUtils;
import org.apache.servicecomb.registry.api.registry.MicroserviceInstance;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.CollectionUtils;
/**
* Simple implementation of .MicroserviceInstancePing using telnet
*/
public class SimpleMicroserviceInstancePing implements MicroserviceInstancePing {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SimpleMicroserviceInstancePing.class);
Review comment:
done, but I'm not sure if I did it right
--
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 change in pull request #2626: Optimize the ping method
Posted by GitBox <gi...@apache.org>.
liubao68 commented on a change in pull request #2626:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2626#discussion_r737108796
##########
File path: foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/SimpleMicroserviceInstancePing.java
##########
@@ -23,27 +23,34 @@
import org.apache.servicecomb.foundation.common.net.IpPort;
import org.apache.servicecomb.foundation.common.net.NetUtils;
import org.apache.servicecomb.registry.api.registry.MicroserviceInstance;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.CollectionUtils;
/**
* Simple implementation of .MicroserviceInstancePing using telnet
*/
public class SimpleMicroserviceInstancePing implements MicroserviceInstancePing {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SimpleMicroserviceInstancePing.class);
+
@Override
public int getOrder() {
- return 100;
+ return 100;
}
@Override
public boolean ping(MicroserviceInstance instance) {
- if (instance.getEndpoints() != null && instance.getEndpoints().size() > 0) {
- IpPort ipPort = NetUtils.parseIpPortFromURI(instance.getEndpoints().get(0));
- try (Socket s = new Socket()) {
- s.connect(new InetSocketAddress(ipPort.getHostOrIp(), ipPort.getPort()), 3000);
- return true;
- } catch (IOException e) {
- // ignore this error
+ if (!CollectionUtils.isEmpty(instance.getEndpoints())){
+ for (String endpoint : instance.getEndpoints()) {
+ IpPort ipPort = NetUtils.parseIpPortFromURI(endpoint);
+ try (Socket s = new Socket()) {
+ s.connect(new InetSocketAddress(ipPort.getHostOrIp(), ipPort.getPort()), 3000);
+ return true;
+ } catch (IOException e) {
+ LOGGER.warn("IOException, probable ping instance failed endpoint is {}", endpoint);
Review comment:
"ping instance {} endpoint {} failed", instanceid, endpoint
--
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] five111 commented on a change in pull request #2626: [SCB-2351] Optimize the ping method
Posted by GitBox <gi...@apache.org>.
five111 commented on a change in pull request #2626:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2626#discussion_r737164123
##########
File path: foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/SimpleMicroserviceInstancePing.java
##########
@@ -23,27 +23,34 @@
import org.apache.servicecomb.foundation.common.net.IpPort;
import org.apache.servicecomb.foundation.common.net.NetUtils;
import org.apache.servicecomb.registry.api.registry.MicroserviceInstance;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.CollectionUtils;
/**
* Simple implementation of .MicroserviceInstancePing using telnet
*/
public class SimpleMicroserviceInstancePing implements MicroserviceInstancePing {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SimpleMicroserviceInstancePing.class);
+
@Override
public int getOrder() {
- return 100;
+ return 100;
}
@Override
public boolean ping(MicroserviceInstance instance) {
- if (instance.getEndpoints() != null && instance.getEndpoints().size() > 0) {
- IpPort ipPort = NetUtils.parseIpPortFromURI(instance.getEndpoints().get(0));
- try (Socket s = new Socket()) {
- s.connect(new InetSocketAddress(ipPort.getHostOrIp(), ipPort.getPort()), 3000);
- return true;
- } catch (IOException e) {
- // ignore this error
+ if (!CollectionUtils.isEmpty(instance.getEndpoints())){
+ for (String endpoint : instance.getEndpoints()) {
+ IpPort ipPort = NetUtils.parseIpPortFromURI(endpoint);
+ try (Socket s = new Socket()) {
+ s.connect(new InetSocketAddress(ipPort.getHostOrIp(), ipPort.getPort()), 3000);
+ return true;
+ } catch (IOException e) {
+ LOGGER.warn("IOException, probable ping instance failed endpoint is {}", endpoint);
Review comment:
done
--
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 #2626: Optimize the ping method
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #2626:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2626#issuecomment-952499186
# [Codecov](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626?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 [#2626](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (720f13b) into [master](https://codecov.io/gh/apache/servicecomb-java-chassis/commit/3286fa4e6235b14809b62e35becb1cbb49ca260d?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (3286fa4) will **increase** coverage by `0.00%`.
> The diff coverage is `91.66%`.
> :exclamation: Current head 720f13b differs from pull request most recent head d2f2811. Consider uploading reports for the commit d2f2811 to get more accurate results
[](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #2626 +/- ##
=========================================
Coverage 77.72% 77.72%
Complexity 1429 1429
=========================================
Files 1598 1598
Lines 42652 42656 +4
Branches 3591 3592 +1
=========================================
+ Hits 33151 33156 +5
Misses 8000 8000
+ Partials 1501 1500 -1
```
| [Impacted Files](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...istry/consumer/SimpleMicroserviceInstancePing.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626/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-Zm91bmRhdGlvbnMvZm91bmRhdGlvbi1yZWdpc3RyeS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvcmVnaXN0cnkvY29uc3VtZXIvU2ltcGxlTWljcm9zZXJ2aWNlSW5zdGFuY2VQaW5nLmphdmE=) | `92.30% <91.66%> (+14.52%)` | :arrow_up: |
| [...he/servicecomb/foundation/common/net/NetUtils.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626/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-Zm91bmRhdGlvbnMvZm91bmRhdGlvbi1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NlcnZpY2Vjb21iL2ZvdW5kYXRpb24vY29tbW9uL25ldC9OZXRVdGlscy5qYXZh) | `62.99% <0.00%> (-1.58%)` | :arrow_down: |
| [.../servicecomb/registry/discovery/DiscoveryTree.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626/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-Zm91bmRhdGlvbnMvZm91bmRhdGlvbi1yZWdpc3RyeS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvcmVnaXN0cnkvZGlzY292ZXJ5L0Rpc2NvdmVyeVRyZWUuamF2YQ==) | `100.00% <0.00%> (+3.50%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626?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/2626?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 [3286fa4...d2f2811](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626?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 merged pull request #2626: [SCB-2351] Optimize the ping method
Posted by GitBox <gi...@apache.org>.
liubao68 merged pull request #2626:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2626
--
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 edited a comment on pull request #2626: [SCB-2351] Optimize the ping method
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #2626:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2626#issuecomment-952499186
# [Codecov](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626?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 [#2626](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (43b49d2) into [master](https://codecov.io/gh/apache/servicecomb-java-chassis/commit/3286fa4e6235b14809b62e35becb1cbb49ca260d?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (3286fa4) will **increase** coverage by `0.01%`.
> The diff coverage is `88.88%`.
[](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #2626 +/- ##
============================================
+ Coverage 77.72% 77.74% +0.01%
Complexity 1429 1429
============================================
Files 1598 1598
Lines 42652 42657 +5
Branches 3591 3592 +1
============================================
+ Hits 33151 33162 +11
+ Misses 8000 7996 -4
+ Partials 1501 1499 -2
```
| [Impacted Files](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...istry/consumer/SimpleMicroserviceInstancePing.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626/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-Zm91bmRhdGlvbnMvZm91bmRhdGlvbi1yZWdpc3RyeS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvcmVnaXN0cnkvY29uc3VtZXIvU2ltcGxlTWljcm9zZXJ2aWNlSW5zdGFuY2VQaW5nLmphdmE=) | `92.30% <88.88%> (+14.52%)` | :arrow_up: |
| [.../servicecomb/registry/discovery/DiscoveryTree.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626/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-Zm91bmRhdGlvbnMvZm91bmRhdGlvbi1yZWdpc3RyeS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvcmVnaXN0cnkvZGlzY292ZXJ5L0Rpc2NvdmVyeVRyZWUuamF2YQ==) | `100.00% <0.00%> (+3.50%)` | :arrow_up: |
| [...config/kie/client/model/ConfigurationsRequest.java](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626/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-Y2xpZW50cy9jb25maWcta2llLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2VydmljZWNvbWIvY29uZmlnL2tpZS9jbGllbnQvbW9kZWwvQ29uZmlndXJhdGlvbnNSZXF1ZXN0LmphdmE=) | `21.05% <0.00%> (+21.05%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626?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/2626?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 [3286fa4...43b49d2](https://codecov.io/gh/apache/servicecomb-java-chassis/pull/2626?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 change in pull request #2626: Optimize the ping method
Posted by GitBox <gi...@apache.org>.
liubao68 commented on a change in pull request #2626:
URL: https://github.com/apache/servicecomb-java-chassis/pull/2626#discussion_r737108359
##########
File path: foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/consumer/SimpleMicroserviceInstancePing.java
##########
@@ -23,27 +23,34 @@
import org.apache.servicecomb.foundation.common.net.IpPort;
import org.apache.servicecomb.foundation.common.net.NetUtils;
import org.apache.servicecomb.registry.api.registry.MicroserviceInstance;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.CollectionUtils;
/**
* Simple implementation of .MicroserviceInstancePing using telnet
*/
public class SimpleMicroserviceInstancePing implements MicroserviceInstancePing {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SimpleMicroserviceInstancePing.class);
Review comment:
1. use etc/*.xml code formatter formate code
2. create a JIRA issue and submit a PR with JIRA id, see other PRs
--
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