/** * Sample all the mutable metrics and put the snapshot in the builder * @param builder to contain the metrics snapshot * @param all get all the metrics even if the values are not changed. */ public void snapshot(MetricsRecordBuilder builder, boolean all) { for (MetricsTag tag : tags()) { builder.add(tag); } for (MutableMetric metric : metrics()) { metric.snapshot(builder, all); } }
.addGauge(Interns.info("Remaining", "Total bytes of free storage"), beanClass.getRemaining()) .add(new MetricsTag(Interns.info("StorageInfo", "Storage ID"), beanClass.getStorageInfo())) .addGauge(Interns.info("NumFailedVolumes", "Number of failed Volumes" +
@Test public void testHybrid() { HybridMetrics metrics = new HybridMetrics(); MetricsSource source = MetricsAnnotations.makeSource(metrics); assertSame(metrics, source); metrics.C0.incr(); MetricsRecordBuilder rb = getMetrics(source); MetricsCollector collector = rb.parent(); verify(collector).addRecord("foo"); verify(collector).addRecord("bar"); verify(collector).addRecord(info("HybridMetrics", "HybridMetrics")); verify(rb).setContext("foocontext"); verify(rb).addCounter(info("C1", "C1 desc"), 1); verify(rb).setContext("barcontext"); verify(rb).addGauge(info("G1", "G1 desc"), 1); verify(rb).add(tag(MsInfo.Context, "hybrid")); verify(rb).addCounter(info("C0", "C0 desc"), 1); verify(rb).addGauge(info("G0", "G0"), 0); }
@Test public void testHybrid() { HybridMetrics metrics = new HybridMetrics(); MetricsSource source = MetricsAnnotations.makeSource(metrics); assertSame(metrics, source); metrics.C0.incr(); MetricsRecordBuilder rb = getMetrics(source); MetricsCollector collector = rb.parent(); verify(collector).addRecord("foo"); verify(collector).addRecord("bar"); verify(collector).addRecord(info("HybridMetrics", "HybridMetrics")); verify(rb).setContext("foocontext"); verify(rb).addCounter(info("C1", "C1 desc"), 1); verify(rb).setContext("barcontext"); verify(rb).addGauge(info("G1", "G1 desc"), 1); verify(rb).add(tag(MsInfo.Context, "hybrid")); verify(rb).addCounter(info("C0", "C0 desc"), 1); verify(rb).addGauge(info("G0", "G0"), 0); }
/** * Sample all the mutable metrics and put the snapshot in the builder * @param builder to contain the metrics snapshot * @param all get all the metrics even if the values are not changed. */ public synchronized void snapshot(MetricsRecordBuilder builder, boolean all) { for (MetricsTag tag : tags()) { builder.add(tag); } for (MutableMetric metric : metrics()) { metric.snapshot(builder, all); } }
/** * Sample all the mutable metrics and put the snapshot in the builder * @param builder to contain the metrics snapshot * @param all get all the metrics even if the values are not changed. */ public void snapshot(MetricsRecordBuilder builder, boolean all) { for (Entry<String, MetricsTag> entry : tags()) { builder.add(entry.getValue()); } for (Entry<String, MetricMutable> entry : metrics()) { entry.getValue().snapshot(builder, all); } }
/** * Sample all the mutable metrics and put the snapshot in the builder * @param builder to contain the metrics snapshot * @param all get all the metrics even if the values are not changed. */ public void snapshot(MetricsRecordBuilder builder, boolean all) { for (MetricsTag tag : tags()) { builder.add(tag); } for (MutableMetric metric : metrics()) { metric.snapshot(builder, all); } }
/** * Sample all the mutable metrics and put the snapshot in the builder * @param builder to contain the metrics snapshot * @param all get all the metrics even if the values are not changed. */ public synchronized void snapshot(MetricsRecordBuilder builder, boolean all) { for (MetricsTag tag : tags()) { builder.add(tag); } for (MutableMetric metric : metrics()) { metric.snapshot(builder, all); } }
/** * Sample all the mutable metrics and put the snapshot in the builder * @param builder to contain the metrics snapshot * @param all get all the metrics even if the values are not changed. */ public synchronized void snapshot(MetricsRecordBuilder builder, boolean all) { for (MetricsTag tag : tags()) { builder.add(tag); } for (MutableMetric metric : metrics()) { metric.snapshot(builder, all); } }
/** * Sample all the mutable metrics and put the snapshot in the builder * @param builder to contain the metrics snapshot * @param all get all the metrics even if the values are not changed. */ public void snapshot(MetricsRecordBuilder builder, boolean all) { for (MetricsTag tag : tags()) { builder.add(tag); } for (MutableMetric metric : metrics()) { metric.snapshot(builder, all); } }
/** * Sample all the mutable metrics and put the snapshot in the builder * @param builder to contain the metrics snapshot * @param all get all the metrics even if the values are not changed. */ public synchronized void snapshot(MetricsRecordBuilder builder, boolean all) { for (MetricsTag tag : tags()) { builder.add(tag); } for (MutableMetric metric : metrics()) { metric.snapshot(builder, all); } }
/** * Sample all the mutable metrics and put the snapshot in the builder * @param builder to contain the metrics snapshot * @param all get all the metrics even if the values are not changed. */ public synchronized void snapshot(MetricsRecordBuilder builder, boolean all) { for (MetricsTag tag : tags()) { builder.add(tag); } for (MutableMetric metric : metrics()) { metric.snapshot(builder, all); } }
/** * Sample all the mutable metrics and put the snapshot in the builder * @param builder to contain the metrics snapshot * @param all get all the metrics even if the values are not changed. */ public void snapshot(MetricsRecordBuilder builder, boolean all) { for (MetricsTag tag : tags()) { builder.add(tag); } for (MutableMetric metric : metrics()) { metric.snapshot(builder, all); } }
@Test public void testMetricTags() throws Exception { String accountName = testAccount.getRealAccount().getBlobEndpoint() .getAuthority(); String containerName = testAccount.getRealContainer().getName(); MetricsRecordBuilder myMetrics = getMyMetrics(); verify(myMetrics).add(argThat( new TagMatcher("accountName", accountName) )); verify(myMetrics).add(argThat( new TagMatcher("containerName", containerName) )); verify(myMetrics).add(argThat( new TagMatcher("Context", "azureFileSystem") )); verify(myMetrics).add(argThat( new TagExistsMatcher("wasbFileSystemId") )); }
@Test public void testMetricTags() throws Exception { String accountName = getTestAccount().getRealAccount().getBlobEndpoint() .getAuthority(); String containerName = getTestAccount().getRealContainer().getName(); MetricsRecordBuilder myMetrics = getMyMetrics(); verify(myMetrics).add(argThat( new TagMatcher("accountName", accountName) )); verify(myMetrics).add(argThat( new TagMatcher("containerName", containerName) )); verify(myMetrics).add(argThat( new TagMatcher("Context", "azureFileSystem") )); verify(myMetrics).add(argThat( new TagExistsMatcher("wasbFileSystemId") )); }
@Test public void testClasses() { MetricsRecordBuilder rb = getMetrics( MetricsAnnotations.makeSource(new MyMetrics3())); MetricsCollector collector = rb.parent(); verify(collector).addRecord(info("MyMetrics3", "My metrics")); verify(rb).add(tag(MsInfo.Context, "foo")); }
@Test public void testClasses() { MetricsRecordBuilder rb = getMetrics( MetricsAnnotations.makeSource(new MyMetrics3())); MetricsCollector collector = rb.parent(); verify(collector).addRecord(info("MyMetrics3", "My metrics")); verify(rb).add(tag(MsInfo.Context, "foo")); }