You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by GitBox <gi...@apache.org> on 2019/06/27 21:28:44 UTC

[GitHub] [incubator-gobblin] ibuenros commented on a change in pull request #2678: [GOBBLIN-807] TimingEvent is now closeable, extends GobblinEventBuilder

ibuenros commented on a change in pull request #2678: [GOBBLIN-807] TimingEvent is now closeable, extends GobblinEventBuilder
URL: https://github.com/apache/incubator-gobblin/pull/2678#discussion_r298376749
 
 

 ##########
 File path: gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/event/EventSubmitter.java
 ##########
 @@ -79,23 +79,49 @@ public EventSubmitter build() {
     }
   }
 
+  public EventSubmitter(MetricContext context) {
+    this.metricContext = Optional.of(context);
+    this.namespace = GobblinEventBuilder.NAMESPACE;
+    this.metadata = Maps.newHashMap();
+  }
+
+  public void submit(GobblinEventBuilder eventBuilder) {
+    eventBuilder.addAdditionalMetadata(this.metadata);
+    this.metricContext.get().submitEvent(eventBuilder.build());
+  }
+
+  public static void submit(MetricContext context, GobblinEventBuilder builder) {
+    context.submitEvent(builder.build());
+  }
+
+  /**
+   *
+   * @deprecated use {@link #EventSubmitter(MetricContext)}
+   */
+  @Deprecated
 
 Review comment:
   Why is the builder pattern deprecated? How would a user add metadata to the event submitter?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services