beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tg...@apache.org
Subject [1/2] incubator-beam git commit: Don't incorrectly log error in MetricsEnvironment
Date Thu, 15 Dec 2016 19:12:11 GMT
Repository: incubator-beam
Updated Branches:
  refs/heads/release-0.4.0-incubating 5dcffe066 -> c09fbd43b


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/e864ac21
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/e864ac21
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/e864ac21

Branch: refs/heads/release-0.4.0-incubating
Commit: e864ac2141e31a930b85264506d06579ba6811de
Parents: 5dcffe0
Author: bchambers <bchambers@google.com>
Authored: Wed Dec 14 11:23:39 2016 -0800
Committer: Thomas Groh <tgroh@google.com>
Committed: Thu Dec 15 11:12:00 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/e864ac21/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