asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mb...@apache.org
Subject asterixdb git commit: [NO ISSUE][HYR] Support modifying Tracer categories after init
Date Thu, 26 Oct 2017 15:14:17 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 8ecbff115 -> 2cba46880


[NO ISSUE][HYR] Support modifying Tracer categories after init

Change-Id: Id209ade0cd20022ad9ae2c9d0c49689081f112a7
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2105
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/2cba4688
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/2cba4688
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/2cba4688

Branch: refs/heads/master
Commit: 2cba4688062806b4277cfb26bc91b154ed3950b2
Parents: 8ecbff1
Author: Michael Blow <michael.blow@couchbase.com>
Authored: Thu Oct 26 00:25:42 2017 -0400
Committer: Michael Blow <mblow@apache.org>
Committed: Thu Oct 26 08:14:04 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/hyracks/util/trace/ITracer.java     |  7 +++++++
 .../main/java/org/apache/hyracks/util/trace/Tracer.java |  4 ++++
 .../java/org/apache/hyracks/util/trace/TraceTest.java   | 12 ++++++++++++
 3 files changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2cba4688/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/ITracer.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/ITracer.java
b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/ITracer.java
index 4f1c2b9..908dc1c 100644
--- a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/ITracer.java
+++ b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/ITracer.java
@@ -63,6 +63,11 @@ public interface ITracer {
         }
 
         @Override
+        public void setCategories(String... categories) {
+            // nothing to do here
+        }
+
+        @Override
         public boolean isEnabled(long cat) {
             return false;
         }
@@ -92,6 +97,8 @@ public interface ITracer {
 
     ITraceCategoryRegistry getRegistry();
 
+    void setCategories(String... categories);
+
     boolean isEnabled(long cat);
 
     long durationB(String name, long cat, String args);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2cba4688/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/Tracer.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/Tracer.java
b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/Tracer.java
index 72a9989..4c6f234 100644
--- a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/Tracer.java
+++ b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/trace/Tracer.java
@@ -57,6 +57,10 @@ public class Tracer implements ITracer {
 
     public Tracer(String name, String[] categories, TraceCategoryRegistry registry) {
         this(name, ITraceCategoryRegistry.CATEGORIES_ALL, registry);
+        setCategories(categories);
+    }
+
+    public void setCategories(String... categories) {
         LOGGER.info("Set categories for Tracer " + this.traceLog.getName() + " to " + Arrays.toString(categories));
         this.categories = getRegistry().get(categories);
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2cba4688/hyracks-fullstack/hyracks/hyracks-util/src/test/java/org/apache/hyracks/util/trace/TraceTest.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/test/java/org/apache/hyracks/util/trace/TraceTest.java
b/hyracks-fullstack/hyracks/hyracks-util/src/test/java/org/apache/hyracks/util/trace/TraceTest.java
index 4b36013..02bf41c 100644
--- a/hyracks-fullstack/hyracks/hyracks-util/src/test/java/org/apache/hyracks/util/trace/TraceTest.java
+++ b/hyracks-fullstack/hyracks/hyracks-util/src/test/java/org/apache/hyracks/util/trace/TraceTest.java
@@ -74,5 +74,17 @@ public class TraceTest {
         for (String line : lines) {
             Assert.assertFalse(validate(line).get("cat").equals("CAT3"));
         }
+        tracer.setCategories("CAT1", "CAT3");
+        os.reset();
+
+        tracer.instant("test1", cat1, ITracer.Scope.p, null);
+        tracer.instant("test2", cat2, ITracer.Scope.p, null);
+        tracer.instant("test3", cat3, ITracer.Scope.p, null);
+
+        handler.flush();
+        lines = os.toString().split("\n");
+        for (String line : lines) {
+            Assert.assertFalse(validate(line).get("cat").equals("CAT2"));
+        }
     }
 }


Mime
View raw message