Will-Lo commented on code in PR #3894:
URL: https://github.com/apache/gobblin/pull/3894#discussion_r1521774012


##########
gobblin-temporal/src/main/java/org/apache/gobblin/temporal/workflows/metrics/EventSubmitterContext.java:
##########
@@ -68,6 +75,39 @@ public EventSubmitterContext(EventSubmitter eventSubmitter) {
     this(eventSubmitter.getTags(), eventSubmitter.getNamespace());
   }
 
+  public EventSubmitterContext augmentWithGaaSMetadata(Properties jobProps) {
+    // TODO: Add temporal specific metadata tags
+    List<Tag<?>> metadataTags = new ArrayList<>(this.tags);
+
+    if (jobProps.containsKey(ConfigurationKeys.FLOW_GROUP_KEY)) {
+      metadataTags.add(new 
Tag<>(TimingEvent.FlowEventConstants.FLOW_GROUP_FIELD, 
jobProps.getProperty(ConfigurationKeys.FLOW_GROUP_KEY)));
+      metadataTags.add(new 
Tag<>(TimingEvent.FlowEventConstants.FLOW_NAME_FIELD, 
jobProps.getProperty(ConfigurationKeys.FLOW_NAME_KEY)));
+      metadataTags.add(new 
Tag<>(TimingEvent.FlowEventConstants.FLOW_EXECUTION_ID_FIELD, 
jobProps.getProperty(ConfigurationKeys.FLOW_EXECUTION_ID_KEY)));
+    }
+
+    if (jobProps.containsKey(ConfigurationKeys.JOB_CURRENT_ATTEMPTS)) {
+      metadataTags.add(new 
Tag<>(TimingEvent.FlowEventConstants.CURRENT_ATTEMPTS_FIELD,
+          jobProps.getProperty(ConfigurationKeys.JOB_CURRENT_ATTEMPTS, "1")));
+      metadataTags.add(new 
Tag<>(TimingEvent.FlowEventConstants.CURRENT_GENERATION_FIELD,
+          jobProps.getProperty(ConfigurationKeys.JOB_CURRENT_GENERATION, 
"1")));
+      metadataTags.add(new 
Tag<>(TimingEvent.FlowEventConstants.SHOULD_RETRY_FIELD,
+          "false"));
+    }
+
+    //Use azkaban.flow.execid as the jobExecutionId
+    metadataTags.add(new 
Tag<>(TimingEvent.FlowEventConstants.JOB_EXECUTION_ID_FIELD, "0"));
+
+    metadataTags.add(new Tag<>(TimingEvent.FlowEventConstants.JOB_GROUP_FIELD,
+        jobProps.getProperty(ConfigurationKeys.JOB_GROUP_KEY, "")));
+    metadataTags.add(new Tag<>(TimingEvent.FlowEventConstants.JOB_NAME_FIELD,
+        jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY, "")));
+    metadataTags.add(new Tag<>(TimingEvent.METADATA_MESSAGE, ""));
+
+    metadataTags.add(new Tag<>(Help.USER_TO_PROXY_KEY, 
jobProps.getProperty(Help.USER_TO_PROXY_KEY, "")));
+    this.tags = metadataTags;
+    return this;

Review Comment:
   In this case I'll adopt a builder pattern



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to