incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [1/4] git commit: Adding metrics for FST size.
Date Mon, 02 Mar 2015 14:54:49 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master f05cf0776 -> da4ad62d6


Adding metrics for FST size.


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

Branch: refs/heads/master
Commit: 8f26d68bfe983b63564df0ddd349b17596015fa5
Parents: f05cf07
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon Mar 2 09:44:43 2015 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon Mar 2 09:44:43 2015 -0500

----------------------------------------------------------------------
 .../lucene/fst/ByteArrayPrimitiveFactory.java   | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/8f26d68b/blur-store/src/main/java/org/apache/blur/lucene/fst/ByteArrayPrimitiveFactory.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/lucene/fst/ByteArrayPrimitiveFactory.java
b/blur-store/src/main/java/org/apache/blur/lucene/fst/ByteArrayPrimitiveFactory.java
index e5f73a2..fd7d26a 100644
--- a/blur-store/src/main/java/org/apache/blur/lucene/fst/ByteArrayPrimitiveFactory.java
+++ b/blur-store/src/main/java/org/apache/blur/lucene/fst/ByteArrayPrimitiveFactory.java
@@ -16,16 +16,36 @@
  */
 package org.apache.blur.lucene.fst;
 
+import static org.apache.blur.metrics.MetricsConstants.ORG_APACHE_BLUR;
+import static org.apache.blur.metrics.MetricsConstants.SIZE;
+
+import java.util.concurrent.atomic.AtomicLong;
+
 import org.apache.blur.BlurConfiguration;
 
+import com.yammer.metrics.Metrics;
+import com.yammer.metrics.core.Gauge;
+import com.yammer.metrics.core.MetricName;
+
 public class ByteArrayPrimitiveFactory extends ByteArrayFactory {
 
+  private static final String FST = "FST";
+
+  private final AtomicLong _size = new AtomicLong();
+
   public ByteArrayPrimitiveFactory(BlurConfiguration configuration) {
     super(configuration);
+    Metrics.newGauge(new MetricName(ORG_APACHE_BLUR, FST, SIZE), new Gauge<Long>()
{
+      @Override
+      public Long value() {
+        return _size.get();
+      }
+    });
   }
 
   @Override
   public ByteArray newByteArray(int size) {
+    _size.addAndGet(size);
     return new ByteArrayPrimitive(size);
   }
 


Mime
View raw message