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
--
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]