Updated Branches: refs/heads/master d5b9564aa -> 708dbf5b7
adding event handling logic for member wise load events Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/4f0184e6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/4f0184e6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/4f0184e6 Branch: refs/heads/master Commit: 4f0184e673b3a38a6d63a247f0ff228ca7eba242 Parents: f3e0efc Author: Lahiru Sandaruwan <[email protected]> Authored: Tue Dec 17 12:44:10 2013 +0530 Committer: Lahiru Sandaruwan <[email protected]> Committed: Tue Dec 17 12:44:10 2013 +0530 ---------------------------------------------------------------------- .../apache/stratos/autoscaler/Constants.java | 15 +++++++++--- .../health/HealthEventMessageDelegator.java | 25 +++++++++++++++----- 2 files changed, 31 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4f0184e6/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/Constants.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/Constants.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/Constants.java index f682260..f6899df 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/Constants.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/Constants.java @@ -21,15 +21,24 @@ public class Constants { // partition properties public static final String REGION_PROPERTY = "region"; + public static final String MEMBER_AVERAGE_LOAD_AVERAGE = "member_average_load_average"; + public static final String MEMBER_AVERAGE_MEMORY_CONSUMPTION = "member_average_memory_consumption"; + public static final String AVERAGE_REQUESTS_IN_FLIGHT = "average_in_flight_requests"; + + public static final String MEMBER_GRADIENT_LOAD_AVERAGE = "member_gradient_load_average"; + public static final String MEMBER_GRADIENT_MEMORY_CONSUMPTION = "member_gradient_memory_consumption"; + public static final String GRADIENT_OF_REQUESTS_IN_FLIGHT = "gradient_in_flight_requests"; + + public static final String MEMBER_SECOND_DERIVATIVE_OF_MEMORY_CONSUMPTION = "member_second_derivative_memory_consumption"; + public static final String MEMBER_SECOND_DERIVATIVE_OF_LOAD_AVERAGE = "member_second_derivative_load_average"; + public static final String SECOND_DERIVATIVE_OF_REQUESTS_IN_FLIGHT = "second_derivative_in_flight_requests"; + public static final String AVERAGE_LOAD_AVERAGE = "average_load_average"; public static final String AVERAGE_MEMORY_CONSUMPTION = "average_memory_consumption"; - public static final String AVERAGE_REQUESTS_IN_FLIGHT = "average_in_flight_requests"; public static final String GRADIENT_LOAD_AVERAGE = "gradient_load_average"; public static final String GRADIENT_MEMORY_CONSUMPTION = "gradient_memory_consumption"; - public static final String GRADIENT_OF_REQUESTS_IN_FLIGHT = "gradient_in_flight_requests"; - public static final String SECOND_DERIVATIVE_OF_REQUESTS_IN_FLIGHT = "second_derivative_in_flight_requests"; public static final String SECOND_DERIVATIVE_OF_MEMORY_CONSUMPTION = "second_derivative_memory_consumption"; public static final String SECOND_DERIVATIVE_OF_LOAD_AVERAGE = "second_derivative_load_average"; } http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4f0184e6/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/HealthEventMessageDelegator.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/HealthEventMessageDelegator.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/HealthEventMessageDelegator.java index fc4d30d..120defc 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/HealthEventMessageDelegator.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/HealthEventMessageDelegator.java @@ -124,7 +124,7 @@ public class HealthEventMessageDelegator implements Runnable { } else { handleMemberFaultEvent(clusterId, memberId); } - } else if(Constants.AVERAGE_LOAD_AVERAGE.equals(event.getEventName())) { + } else if(Constants.MEMBER_AVERAGE_LOAD_AVERAGE.equals(event.getEventName())) { LoadAverage loadAverage = findLoadAverage(event); if(loadAverage != null) { String value = event.getProperties().get("value"); @@ -135,7 +135,7 @@ public class HealthEventMessageDelegator implements Runnable { log.debug(String.format("%s event: [member] %s [value] %s", event.getProperties().get("member_id"), value)); } } - } else if(Constants.SECOND_DERIVATIVE_OF_LOAD_AVERAGE.equals(event.getEventName())) { + } else if(Constants.MEMBER_SECOND_DERIVATIVE_OF_LOAD_AVERAGE.equals(event.getEventName())) { LoadAverage loadAverage = findLoadAverage(event); if(loadAverage != null) { String value = event.getProperties().get("value"); @@ -146,7 +146,7 @@ public class HealthEventMessageDelegator implements Runnable { log.debug(String.format("%s event: [member] %s [value] %s", event.getProperties().get("member_id"), value)); } } - } else if(Constants.GRADIENT_LOAD_AVERAGE.equals(event.getEventName())) { + } else if(Constants.MEMBER_GRADIENT_LOAD_AVERAGE.equals(event.getEventName())) { LoadAverage loadAverage = findLoadAverage(event); if(loadAverage != null) { String value = event.getProperties().get("value"); @@ -157,7 +157,7 @@ public class HealthEventMessageDelegator implements Runnable { log.debug(String.format("%s event: [member] %s [value] %s", event.getProperties().get("member_id"), value)); } } - } else if(Constants.AVERAGE_MEMORY_CONSUMPTION.equals(event.getEventName())) { + } else if(Constants.MEMBER_AVERAGE_MEMORY_CONSUMPTION.equals(event.getEventName())) { MemoryConsumption memoryConsumption = findMemoryConsumption(event); if(memoryConsumption != null) { String value = event.getProperties().get("value"); @@ -168,7 +168,7 @@ public class HealthEventMessageDelegator implements Runnable { log.debug(String.format("%s event: [member] %s [value] %s", event.getProperties().get("member_id"), value)); } } - } else if(Constants.SECOND_DERIVATIVE_OF_MEMORY_CONSUMPTION.equals(event.getEventName())) { + } else if(Constants.MEMBER_SECOND_DERIVATIVE_OF_MEMORY_CONSUMPTION.equals(event.getEventName())) { MemoryConsumption memoryConsumption = findMemoryConsumption(event); if(memoryConsumption != null) { String value = event.getProperties().get("value"); @@ -179,7 +179,7 @@ public class HealthEventMessageDelegator implements Runnable { log.debug(String.format("%s event: [member] %s [value] %s", event.getProperties().get("member_id"), value)); } } - } else if(Constants.GRADIENT_MEMORY_CONSUMPTION.equals(event.getEventName())) { + } else if(Constants.MEMBER_GRADIENT_MEMORY_CONSUMPTION.equals(event.getEventName())) { MemoryConsumption memoryConsumption = findMemoryConsumption(event); if(memoryConsumption != null) { String value = event.getProperties().get("value"); @@ -190,6 +190,19 @@ public class HealthEventMessageDelegator implements Runnable { log.debug(String.format("%s event: [member] %s [value] %s", event.getProperties().get("member_id"), value)); } } + + } else if(Constants.AVERAGE_LOAD_AVERAGE.equals(event.getEventName())) { + //do nothing for network partition wise events yet + } else if(Constants.SECOND_DERIVATIVE_OF_LOAD_AVERAGE.equals(event.getEventName())) { + //do nothing for network partition wise events yet + } else if(Constants.GRADIENT_LOAD_AVERAGE.equals(event.getEventName())) { + //do nothing for network partition wise events yet + } else if(Constants.AVERAGE_MEMORY_CONSUMPTION.equals(event.getEventName())) { + //do nothing for network partition wise events yet + } else if(Constants.SECOND_DERIVATIVE_OF_MEMORY_CONSUMPTION.equals(event.getEventName())) { + //do nothing for network partition wise events yet + } else if(Constants.GRADIENT_MEMORY_CONSUMPTION.equals(event.getEventName())) { + //do nothing for network partition wise events yet } } catch (Exception e) { log.error("Failed to retrieve the health stat event message.", e);
