[ 
https://issues.apache.org/jira/browse/GOBBLIN-2014?focusedWorklogId=909322&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-909322
 ]

ASF GitHub Bot logged work on GOBBLIN-2014:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 12/Mar/24 02:52
            Start Date: 12/Mar/24 02:52
    Worklog Time Spent: 10m 
      Work Description: phet commented on code in PR #3894:
URL: https://github.com/apache/gobblin/pull/3894#discussion_r1520766809


##########
gobblin-temporal/src/main/java/org/apache/gobblin/temporal/workflows/metrics/EventSubmitterContext.java:
##########
@@ -40,7 +47,7 @@
  */
 @Getter
 public class EventSubmitterContext {
-  private final List<Tag<?>> tags;
+  private List<Tag<?>> tags;

Review Comment:
   `final` could remain if we make this immutable.
   
   IMO, every field being `final` is the sign of a healthy abstraction: fully 
thread-safe and pre-disposed against mistaken/careless usage patterns



##########
gobblin-temporal/src/main/java/org/apache/gobblin/temporal/workflows/metrics/EventSubmitterContext.java:
##########
@@ -17,18 +17,25 @@
 
 package org.apache.gobblin.temporal.workflows.metrics;
 
+import com.google.common.collect.ImmutableCollection;
+import com.google.common.collect.ImmutableList;
+import java.util.ArrayList;
 import java.util.List;
 
 import com.fasterxml.jackson.annotation.JsonCreator;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
+import java.util.Properties;
 import lombok.Getter;

Review Comment:
   `java.` is supposed to go first - 
https://gobblin.apache.org/docs/developer-guide/CodingStyle/
   



##########
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:
   I strongly urge to adopt immutability (i.e. create a new instance, rather 
than mutating this one)



##########
gobblin-temporal/src/main/java/org/apache/gobblin/temporal/workflows/metrics/TemporalEventTimer.java:
##########
@@ -104,7 +104,7 @@ public TemporalEventTimer create(String eventName) {
     public TemporalEventTimer createJobTimer() {
       TemporalEventTimer startTimer = 
create(TimingEvent.LauncherTimings.JOB_START);
       startTimer.stop(Instant.EPOCH); // Emit start job event containing a 
stub end time
-      return create(TimingEvent.LauncherTimings.JOB_COMPLETE, 
startTimer.startTime);
+      return create(TimingEvent.LauncherTimings.JOB_SUCCEEDED, 
startTimer.startTime);

Review Comment:
   suggest a comment to convey that `SUCCEEDED` was chosen in favor of 
`COMPLETE`, to satisfy gaas' expectations





Issue Time Tracking
-------------------

    Worklog Id:     (was: 909322)
    Time Spent: 1h 10m  (was: 1h)

> Add metadata tags for events sent from Temporal to be parseable in GaaS
> -----------------------------------------------------------------------
>
>                 Key: GOBBLIN-2014
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-2014
>             Project: Apache Gobblin
>          Issue Type: Bug
>          Components: gobblin-service
>            Reporter: William Lo
>            Assignee: Abhishek Tiwari
>            Priority: Major
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Gobblin's Temporal workflow launches through `ExecuteGobblinJobLauncher`, but 
> the eventSubmitter created in that class does not have the necessary metadata 
> needed in order to send events to GaaS.
> We want to populate the additional tags to read from the job props that 
> contain the information needed for these events to be readable from GaaS.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to