Source:
public void monitor(ResourceMessage message) { MetricNotificationService metricNotificationService = Services.get().getService(MetricNotificationService.SERVICE_NAME); try { String entityType = message.getDimensions().get("entity-type"); String entityName = message.getDimensions().get("entity-name"); String prefix = StartupProperties.get().getProperty("falcon.graphite.prefix"); if (entityType.equals(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 + pipeline + ".GENERATE." + entityName + ".processing_time"; metricNotificationService.publish(metricsName, timeTaken); DateTime nominalTime = new DateTime(message.getDimensions().get("nominal-time")); DateTime startTime = new DateTime(message.getDimensions().get("start-time")); metricsName = prefix + pipeline + ".GENERATE." + entityName + ".start_delay"; metricNotificationService.publish(metricsName, (long)Seconds.secondsBetween(nominalTime, startTime).getSeconds()); } if (message.getAction().equals("wf-instance-failed")){ String metricName = prefix + pipeline + ".GENERATE." + entityName + ".failure" + message.getDimensions().get("error-message"); metricNotificationService.publish(metricName, (long) 1); } } } catch (Exception e) { LOG.error("Exception in sending metrics to Graphite:", e); } }

Target:
public void monitor(ResourceMessage message) { MetricNotificationService metricNotificationService = Services.get().getService(MetricNotificationService.SERVICE_NAME); try { String entityType = message.getDimensions().get("entity-type"); String entityName = message.getDimensions().get("entity-name"); String prefix = StartupProperties.get().getProperty("falcon.graphite.prefix"); if (entityType.equals(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); 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()); } 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); } } } catch (Exception e) { LOG.error("Exception in sending metrics to Graphite:", e); } }