[jira] [Commented] (CAMEL-12448) camel-consul - service health state calculated from all services with same name

2018-04-16 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-12448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16439426#comment-16439426
 ] 

ASF GitHub Bot commented on CAMEL-12448:


Github user lburgazzoli closed the pull request at:

https://github.com/apache/camel/pull/2296


> camel-consul - service health state calculated from all services with same 
> name
> ---
>
> Key: CAMEL-12448
> URL: https://issues.apache.org/jira/browse/CAMEL-12448
> Project: Camel
>  Issue Type: Bug
>  Components: camel-consul
>Affects Versions: 2.21.0
>Reporter: Vadim R
>Priority: Major
>
> In Consul catalog registered two instances of one service. Health check for 
> first instance have "passed" state, and for second instance - "critical". 
> Camel returns both service instances with healty checks, which method 
> "isHealthy" returns "false".
> I've make some changes in ConsulServiceDiscoveryTest to show up this bug, and 
> fix it in ConsulServiceDiscovery.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12448) camel-consul - service health state calculated from all services with same name

2018-04-16 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-12448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16439425#comment-16439425
 ] 

ASF GitHub Bot commented on CAMEL-12448:


lburgazzoli closed pull request #2296: CAMEL-12448  - camel-consul: filter 
health checks by service id
URL: https://github.com/apache/camel/pull/2296
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java
 
b/components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java
index e7cfd5f7430..74b7c006c35 100644
--- 
a/components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java
+++ 
b/components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java
@@ -99,7 +99,11 @@ private ServiceDefinition newService(String serviceName, 
CatalogService service,
 service.getServiceAddress(),
 service.getServicePort(),
 meta,
-new 
DefaultServiceHealth(serviceHealthList.stream().allMatch(this::isHealthy))
+new DefaultServiceHealth(
+serviceHealthList.stream()
+.filter(h -> 
ObjectHelper.equal(h.getService().getId(), service.getServiceId()))
+.allMatch(this::isHealthy)
+)
 );
 }
 }
diff --git 
a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscoveryTest.java
 
b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscoveryTest.java
index 2523ad74017..119e85b68fd 100644
--- 
a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscoveryTest.java
+++ 
b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscoveryTest.java
@@ -21,6 +21,7 @@
 
 import com.orbitz.consul.AgentClient;
 import com.orbitz.consul.Consul;
+import com.orbitz.consul.model.agent.ImmutableRegCheck;
 import com.orbitz.consul.model.agent.ImmutableRegistration;
 import com.orbitz.consul.model.agent.Registration;
 import org.apache.camel.cloud.ServiceDefinition;
@@ -44,7 +45,12 @@ public void setUp() throws Exception {
 client = Consul.builder().build().agentClient();
 registrations = new ArrayList<>(3);
 
-for (int i = 0; i < 3; i++) {
+for (int i = 0; i < 6; i++) {
+Registration.RegCheck c = ImmutableRegCheck.builder()
+.ttl("1m")
+.status(i < 3 ? "passing" : "critical")
+.build();
+
 Registration r = ImmutableRegistration.builder()
 .id("service-" + i)
 .name("my-service")
@@ -53,6 +59,7 @@ public void setUp() throws Exception {
 .addTags("key1=value1")
 .addTags("key2=value2")
 .port(9000 + i)
+.check(c)
 .build();
 
 client.register(r);
@@ -76,7 +83,7 @@ public void testServiceDiscovery() throws Exception {
 
 List services = discovery.getServices("my-service");
 assertNotNull(services);
-assertEquals(3, services.size());
+assertEquals(6, services.size());
 
 for (ServiceDefinition service : services) {
 assertFalse(service.getMetadata().isEmpty());
@@ -85,6 +92,7 @@ public void testServiceDiscovery() throws Exception {
 assertTrue(service.getMetadata().containsKey("a-tag"));
 assertTrue(service.getMetadata().containsKey("key1"));
 assertTrue(service.getMetadata().containsKey("key2"));
+assertTrue(service.getPort() < 9003 ? 
service.getHealth().isHealthy() : !service.getHealth().isHealthy());
 }
 }
 }


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> camel-consul - service health state calculated from all services with same 
> name
> ---
>
> Key: CAMEL-12448
> URL: https://issues.apache.org/jira/browse/CAMEL-12448
> Project: Camel
>  Issue Type: Bug
>  Components: camel-consul
>Affects Versions: 2.21.0
>Reporter: Vadim R
>Priority: Major
>
> In Consul catalog registered two 

[jira] [Commented] (CAMEL-12448) camel-consul - service health state calculated from all services with same name

2018-04-16 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-12448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16439428#comment-16439428
 ] 

ASF GitHub Bot commented on CAMEL-12448:


lburgazzoli commented on issue #2296: CAMEL-12448  - camel-consul: filter 
health checks by service id
URL: https://github.com/apache/camel/pull/2296#issuecomment-381596076
 
 
   Thx @player13 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> camel-consul - service health state calculated from all services with same 
> name
> ---
>
> Key: CAMEL-12448
> URL: https://issues.apache.org/jira/browse/CAMEL-12448
> Project: Camel
>  Issue Type: Bug
>  Components: camel-consul
>Affects Versions: 2.21.0
>Reporter: Vadim R
>Priority: Major
>
> In Consul catalog registered two instances of one service. Health check for 
> first instance have "passed" state, and for second instance - "critical". 
> Camel returns both service instances with healty checks, which method 
> "isHealthy" returns "false".
> I've make some changes in ConsulServiceDiscoveryTest to show up this bug, and 
> fix it in ConsulServiceDiscovery.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12448) camel-consul - service health state calculated from all services with same name

2018-04-16 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-12448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16439423#comment-16439423
 ] 

ASF GitHub Bot commented on CAMEL-12448:


player13 commented on a change in pull request #2296: CAMEL-12448  - 
camel-consul: filter health checks by service id
URL: https://github.com/apache/camel/pull/2296#discussion_r181729271
 
 

 ##
 File path: 
components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java
 ##
 @@ -62,7 +62,12 @@ public ConsulServiceDiscovery(ConsulConfiguration 
configuration) throws Exceptio
 .getResponse();
 
 return services.stream()
-.map(service -> newService(name, service, healths))
+.map(service -> newService(
+name,
+service,
+healths.stream()
+.filter(serviceHealth -> 
serviceHealth.getService().getId().equals(service.getServiceId()))
+.collect(Collectors.toList(
 
 Review comment:
   Done!


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> camel-consul - service health state calculated from all services with same 
> name
> ---
>
> Key: CAMEL-12448
> URL: https://issues.apache.org/jira/browse/CAMEL-12448
> Project: Camel
>  Issue Type: Bug
>  Components: camel-consul
>Affects Versions: 2.21.0
>Reporter: Vadim R
>Priority: Major
>
> In Consul catalog registered two instances of one service. Health check for 
> first instance have "passed" state, and for second instance - "critical". 
> Camel returns both service instances with healty checks, which method 
> "isHealthy" returns "false".
> I've make some changes in ConsulServiceDiscoveryTest to show up this bug, and 
> fix it in ConsulServiceDiscovery.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12448) camel-consul - service health state calculated from all services with same name

2018-04-16 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-12448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16439408#comment-16439408
 ] 

ASF GitHub Bot commented on CAMEL-12448:


lburgazzoli commented on a change in pull request #2296: CAMEL-12448  - 
camel-consul: filter health checks by service id
URL: https://github.com/apache/camel/pull/2296#discussion_r181725231
 
 

 ##
 File path: 
components/camel-consul/src/main/java/org/apache/camel/component/consul/cloud/ConsulServiceDiscovery.java
 ##
 @@ -62,7 +62,12 @@ public ConsulServiceDiscovery(ConsulConfiguration 
configuration) throws Exceptio
 .getResponse();
 
 return services.stream()
-.map(service -> newService(name, service, healths))
+.map(service -> newService(
+name,
+service,
+healths.stream()
+.filter(serviceHealth -> 
serviceHealth.getService().getId().equals(service.getServiceId()))
+.collect(Collectors.toList(
 
 Review comment:
   Wondering if this can be moved inside `newService`


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> camel-consul - service health state calculated from all services with same 
> name
> ---
>
> Key: CAMEL-12448
> URL: https://issues.apache.org/jira/browse/CAMEL-12448
> Project: Camel
>  Issue Type: Bug
>  Components: camel-consul
>Affects Versions: 2.21.0
>Reporter: Vadim R
>Priority: Major
>
> In Consul catalog registered two instances of one service. Health check for 
> first instance have "passed" state, and for second instance - "critical". 
> Camel returns both service instances with healty checks, which method 
> "isHealthy" returns "false".
> I've make some changes in ConsulServiceDiscoveryTest to show up this bug, and 
> fix it in ConsulServiceDiscovery.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12448) camel-consul - service health state calculated from all services with same name

2018-04-16 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-12448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16439347#comment-16439347
 ] 

ASF GitHub Bot commented on CAMEL-12448:


davsclaus commented on issue #2296: CAMEL-12448  - camel-consul: filter health 
checks by service id
URL: https://github.com/apache/camel/pull/2296#issuecomment-381576196
 
 
   lgtm
   
   @lburgazzoli wonder if you could take a peak as well.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> camel-consul - service health state calculated from all services with same 
> name
> ---
>
> Key: CAMEL-12448
> URL: https://issues.apache.org/jira/browse/CAMEL-12448
> Project: Camel
>  Issue Type: Bug
>  Components: camel-consul
>Affects Versions: 2.21.0
>Reporter: Vadim R
>Priority: Major
>
> In Consul catalog registered two instances of one service. Health check for 
> first instance have "passed" state, and for second instance - "critical". 
> Camel returns both service instances with healty checks, which method 
> "isHealthy" returns "false".
> I've make some changes in ConsulServiceDiscoveryTest to show up this bug, and 
> fix it in ConsulServiceDiscovery.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12448) camel-consul - service health state calculated from all services with same name

2018-04-16 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-12448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16439339#comment-16439339
 ] 

ASF GitHub Bot commented on CAMEL-12448:


GitHub user player13 opened a pull request:

https://github.com/apache/camel/pull/2296

CAMEL-12448  - camel-consul: filter health checks by service id

In Consul catalog registered two instances of one service. Health check for 
first instance have "passed" state, and for second instance - "critical". Camel 
returns both service instances with healty checks, which method "isHealthy" 
returns "false".

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/player13/camel CAMEL-12448

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/camel/pull/2296.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2296


commit 4a521a1fba5ea432838d2d168f72bb7a2eec53b8
Author: Vadim R <8365723+player13@...>
Date:   2018-04-16T11:58:44Z

CAMEL-12448  - camel-consul: filter health checks by service id




> camel-consul - service health state calculated from all services with same 
> name
> ---
>
> Key: CAMEL-12448
> URL: https://issues.apache.org/jira/browse/CAMEL-12448
> Project: Camel
>  Issue Type: Bug
>  Components: camel-consul
>Affects Versions: 2.21.0
>Reporter: Vadim R
>Priority: Major
>
> In Consul catalog registered two instances of one service. Health check for 
> first instance have "passed" state, and for second instance - "critical". 
> Camel returns both service instances with healty checks, which method 
> "isHealthy" returns "false".
> I've make some changes in ConsulServiceDiscoveryTest to show up this bug, and 
> fix it in ConsulServiceDiscovery.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12448) camel-consul - service health state calculated from all services with same name

2018-04-16 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-12448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16439338#comment-16439338
 ] 

ASF GitHub Bot commented on CAMEL-12448:


player13 opened a new pull request #2296: CAMEL-12448  - camel-consul: filter 
health checks by service id
URL: https://github.com/apache/camel/pull/2296
 
 
   In Consul catalog registered two instances of one service. Health check for 
first instance have "passed" state, and for second instance - "critical". Camel 
returns both service instances with healty checks, which method "isHealthy" 
returns "false".


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> camel-consul - service health state calculated from all services with same 
> name
> ---
>
> Key: CAMEL-12448
> URL: https://issues.apache.org/jira/browse/CAMEL-12448
> Project: Camel
>  Issue Type: Bug
>  Components: camel-consul
>Affects Versions: 2.21.0
>Reporter: Vadim R
>Priority: Major
>
> In Consul catalog registered two instances of one service. Health check for 
> first instance have "passed" state, and for second instance - "critical". 
> Camel returns both service instances with healty checks, which method 
> "isHealthy" returns "false".
> I've make some changes in ConsulServiceDiscoveryTest to show up this bug, and 
> fix it in ConsulServiceDiscovery.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)