falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pall...@apache.org
Subject falcon git commit: FALCON-2020 Changes in Graphite Notification Plugin
Date Fri, 10 Jun 2016 07:05:53 GMT
Repository: falcon
Updated Branches:
  refs/heads/master b2f085c7c -> 54430ed27


FALCON-2020 Changes in Graphite Notification Plugin

Author: Praveen Adlakha <adlakha.praveen@gmail.com>

Reviewers: @bvellanki, @pallavi-rao

Closes #180 from PraveenAdlakha/2020 and squashes the following commits:

ecfae9a [Praveen Adlakha] comments addressed
5f3b962 [Praveen Adlakha] FALCON-2020 Changes in Graphite Notification Plugin


Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/54430ed2
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/54430ed2
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/54430ed2

Branch: refs/heads/master
Commit: 54430ed279909c3e7d488e4ef98d05f56c4ecf45
Parents: b2f085c
Author: Praveen Adlakha <adlakha.praveen@gmail.com>
Authored: Fri Jun 10 12:35:39 2016 +0530
Committer: Pallavi Rao <pallavi.rao@inmobi.com>
Committed: Fri Jun 10 12:35:39 2016 +0530

----------------------------------------------------------------------
 .../plugin/GraphiteNotificationPlugin.java      | 35 +++++++++++---------
 1 file changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/54430ed2/prism/src/main/java/org/apache/falcon/plugin/GraphiteNotificationPlugin.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/plugin/GraphiteNotificationPlugin.java
b/prism/src/main/java/org/apache/falcon/plugin/GraphiteNotificationPlugin.java
index 9d46b0d..abe6777 100644
--- a/prism/src/main/java/org/apache/falcon/plugin/GraphiteNotificationPlugin.java
+++ b/prism/src/main/java/org/apache/falcon/plugin/GraphiteNotificationPlugin.java
@@ -45,34 +45,39 @@ public class GraphiteNotificationPlugin implements MonitoringPlugin {
         MetricNotificationService metricNotificationService =
                 Services.get().getService(MetricNotificationService.SERVICE_NAME);
         try {
-            String entityType = message.getDimensions().get("entity-type");
-            String entityName = message.getDimensions().get("entity-name");
+            String entityType = StringUtils.isNotBlank(message.getDimensions().get("entityType"))
+                    ? message.getDimensions().get("entityType") :message.getDimensions().get("entity-type");
+            String entityName = StringUtils.isNotBlank(message.getDimensions().get("entityName"))
+                    ? message.getDimensions().get("entityName") :message.getDimensions().get("entity-name");
             String prefix = StartupProperties.get().getProperty("falcon.graphite.prefix");
-            if (entityType.equals(EntityType.PROCESS.name())) {
+            String separator = ".";
+            LOG.debug("message:" + message.getAction());
+            if (entityType.equalsIgnoreCase(EntityType.PROCESS.name())) {
                 Entity entity = ConfigurationStore.get().get(EntityType.PROCESS, entityName);
                 Process process = (Process) entity;
                 String pipeline =  StringUtils.isNotBlank(process.getPipelines()) ? process.getPipelines()
: "default";
 
-
                 if ((message.getAction().equals("wf-instance-succeeded"))) {
                     Long timeTaken =  message.getExecutionTime() / 1000000000;
-                    String metricsName = prefix + message.getDimensions().get("cluster")
+ pipeline
-                            + ".GENERATE." + entityName + ".processing_time";
-                    metricNotificationService.publish(metricsName, timeTaken);
+                    StringBuilder processingMetric = new StringBuilder(prefix).append(".").append(message.
+                            getDimensions().get("cluster")).append(".").append(pipeline).append(".GENERATE.")
+                            .append(entityName).append(".processing_time");
+                    metricNotificationService.publish(processingMetric.toString(), timeTaken);
 
                     DateTime nominalTime = new DateTime(message.getDimensions().get("nominal-time"));
                     DateTime startTime = new DateTime(message.getDimensions().get("start-time"));
-                    metricsName = prefix + message.getDimensions().get("cluster") + pipeline
-                            + ".GENERATE." + entityName + ".start_delay";
-                    metricNotificationService.publish(metricsName,
-                        (long)Seconds.secondsBetween(nominalTime, startTime).getSeconds());
+                    StringBuilder startTimeMetric = new StringBuilder(prefix).append(".").append(message.
+                            getDimensions().get("cluster")).append(".").append(pipeline).append(".GENERATE.").
+                            append(entityName).append(".start_delay");
+                    metricNotificationService.publish(startTimeMetric.toString(),
+                            (long)Seconds.secondsBetween(nominalTime, startTime).getSeconds());
                 }
 
                 if (message.getAction().equals("wf-instance-failed")){
-                    String metricName =  prefix + message.getDimensions().get("cluster")
+ pipeline
-                            + ".GENERATE." +  entityName + ".failure"
-                        + message.getDimensions().get("error-message");
-                    metricNotificationService.publish(metricName, (long) 1);
+                    StringBuilder metricName = new StringBuilder(prefix).append(".").append(message.
+                            getDimensions().get("cluster")).append(".").append(pipeline).append(".GENERATE.").
+                            append(entityName).append(".failure").append(message.getDimensions().get("error-message"));
+                    metricNotificationService.publish(metricName.toString(), (long) 1);
                 }
             }
         } catch (Exception e) {


Mime
View raw message