beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bchamb...@apache.org
Subject [1/2] incubator-beam git commit: Don't incorrectly log error in MetricsEnvironment
Date Thu, 15 Dec 2016 23:58:43 GMT
Repository: incubator-beam
Updated Branches:
  refs/heads/master 5a3ace4a7 -> 8c1891375


Don't incorrectly log error in MetricsEnvironment

Using getCurrentContainer() logs an error if metrics are not supported.
This is because it acts as the common point of access for user code that
reports metrics.

It should not be used within setCurrentContainer(), because the first
container being set will have a null previous-current-container, which
will cause the error to be incorrectly logged.


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/ce75ba1e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/ce75ba1e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/ce75ba1e

Branch: refs/heads/master
Commit: ce75ba1ec5b4265bad9f3ff9b4b66818424b1375
Parents: 5a3ace4
Author: bchambers <bchambers@google.com>
Authored: Wed Dec 14 11:23:39 2016 -0800
Committer: bchambers <bchambers@google.com>
Committed: Thu Dec 15 15:50:08 2016 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/beam/sdk/metrics/MetricsEnvironment.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/ce75ba1e/sdks/java/core/src/main/java/org/apache/beam/sdk/metrics/MetricsEnvironment.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/metrics/MetricsEnvironment.java
b/sdks/java/core/src/main/java/org/apache/beam/sdk/metrics/MetricsEnvironment.java
index 7c06cbf..5d7cb0b 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/metrics/MetricsEnvironment.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/metrics/MetricsEnvironment.java
@@ -56,7 +56,7 @@ public class MetricsEnvironment {
    */
   @Nullable
   public static MetricsContainer setCurrentContainer(@Nullable MetricsContainer container)
{
-    MetricsContainer previous = getCurrentContainer();
+    MetricsContainer previous = CONTAINER_FOR_THREAD.get();
     if (container == null) {
       CONTAINER_FOR_THREAD.remove();
     } else {


Mime
View raw message