Package org.apache.hadoop.metrics.util

Examples of org.apache.hadoop.metrics.util.MetricsRegistry


  /*
   * @param mr MetricsRegistry.
   * @return A copy of the passed MetricsRegistry minus the hbase metrics
   */
  private static MetricsRegistry copyMinusHBaseMetrics(final MetricsRegistry mr) {
    MetricsRegistry copy = new MetricsRegistry();
    for (MetricsBase metric : mr.getMetricsList()) {
      if (metric instanceof MetricsRate || metric instanceof MetricsString ||
          metric instanceof MetricsHistogram || metric instanceof ExactCounterMetric) {
        continue;
      }
      copy.add(metric.getName(), metric);
    }
    return copy;
  }
View Full Code Here


    // The write timestamp of the last SEP information that came in
    private final MetricsLongValue lastTimestampInputProcessed;

    public SepMetrics(String recordName) {
        this.recordName = recordName;
        metricsRegistry = new MetricsRegistry();
        sepProcessingRate = new MetricsTimeVaryingRate("sepProcessed", metricsRegistry);
        lastTimestampInputProcessed = new MetricsLongValue("lastSepTimestamp", metricsRegistry);

        context = MetricsUtil.getContext("repository");
        metricsRecord = MetricsUtil.createRecord(context, recordName);
View Full Code Here

  /*
   * @param mr MetricsRegistry.
   * @return A copy of the passed MetricsRegistry minus the hbase metrics
   */
  private static MetricsRegistry copyMinusHBaseMetrics(final MetricsRegistry mr) {
    MetricsRegistry copy = new MetricsRegistry();
    for (MetricsBase metric : mr.getMetricsList()) {
      if (metric instanceof MetricsRate || metric instanceof MetricsString ||
          metric instanceof MetricsHistogram || metric instanceof ExactCounterMetric) {
        continue;
      }
      copy.add(metric.getName(), metric);
    }
    return copy;
  }
View Full Code Here

  private MetricsRate metricsRate;
  private MetricsIntValue intValue;
  private MetricsTimeVaryingRate varyRate;

  public void setUp() {
    this.registry = new MetricsRegistry();
    this.metricsRate = new MetricsRate("metricsRate", registry, "test");
    this.intValue = new MetricsIntValue("intValue", registry, "test");
    this.varyRate = new MetricsTimeVaryingRate("varyRate", registry, "test");
    this.stats = new TestStatistics(registry);
    MetricsContext context = MetricsUtil.getContext("hbase");
View Full Code Here

        "varyRateNumOps", "java.lang.Integer", "test");
  }

  public void testMetricsMBeanBaseHistogram()
      throws ReflectionException, AttributeNotFoundException, MBeanException {
    MetricsRegistry mr = new MetricsRegistry();
    MetricsHistogram histo = mock(MetricsHistogram.class);
    Snapshot snap = mock(Snapshot.class);

    //Set up the mocks
    String histoName = "MockHisto";
    when(histo.getName()).thenReturn(histoName);
    when(histo.getCount()).thenReturn(20l);
    when(histo.getMin()).thenReturn(1l);
    when(histo.getMax()).thenReturn(999l);
    when(histo.getMean()).thenReturn(500.2);
    when(histo.getStdDev()).thenReturn(1.2);
    when(histo.getSnapshot()).thenReturn(snap);

    when(snap.getMedian()).thenReturn(490.0);
    when(snap.get75thPercentile()).thenReturn(550.0);
    when(snap.get95thPercentile()).thenReturn(900.0);
    when(snap.get99thPercentile()).thenReturn(990.0);

    mr.add("myTestHisto", histo);

    MetricsMBeanBase mBeanBase = new MetricsMBeanBase(mr, "test");

    assertEquals(new Long(20), mBeanBase
        .getAttribute(histoName + MetricsHistogram.NUM_OPS_METRIC_NAME));
View Full Code Here

  /*
   * @param mr MetricsRegistry.
   * @return A copy of the passed MetricsRegistry minus the hbase metrics
   */
  private static MetricsRegistry copyMinusHBaseMetrics(final MetricsRegistry mr) {
    MetricsRegistry copy = new MetricsRegistry();
    for (MetricsBase metric : mr.getMetricsList()) {
      if (metric instanceof MetricsRate || metric instanceof MetricsString ||
          metric instanceof MetricsHistogram || metric instanceof ExactCounterMetric) {
        continue;
      }
      copy.add(metric.getName(), metric);
    }
    return copy;
  }
View Full Code Here

  private MetricsRate metricsRate;
  private MetricsIntValue intValue;
  private MetricsTimeVaryingRate varyRate;

  public void setUp() {
    this.registry = new MetricsRegistry();
    this.metricsRate = new MetricsRate("metricsRate", registry, "test");
    this.intValue = new MetricsIntValue("intValue", registry, "test");
    this.varyRate = new MetricsTimeVaryingRate("varyRate", registry, "test");
    this.stats = new TestStatistics(registry);
    MetricsContext context = MetricsUtil.getContext("hbase");
View Full Code Here

        "varyRateNumOps", "java.lang.Integer", "test");
  }

  public void testMetricsMBeanBaseHistogram()
      throws ReflectionException, AttributeNotFoundException, MBeanException {
    MetricsRegistry mr = new MetricsRegistry();
    MetricsHistogram histo = mock(MetricsHistogram.class);
    Snapshot snap = mock(Snapshot.class);

    //Set up the mocks
    String histoName = "MockHisto";
    when(histo.getName()).thenReturn(histoName);
    when(histo.getCount()).thenReturn(20l);
    when(histo.getMin()).thenReturn(1l);
    when(histo.getMax()).thenReturn(999l);
    when(histo.getMean()).thenReturn(500.2);
    when(histo.getStdDev()).thenReturn(1.2);
    when(histo.getSnapshot()).thenReturn(snap);

    when(snap.getMedian()).thenReturn(490.0);
    when(snap.get75thPercentile()).thenReturn(550.0);
    when(snap.get95thPercentile()).thenReturn(900.0);
    when(snap.get99thPercentile()).thenReturn(990.0);

    mr.add("myTestHisto", histo);

    MetricsMBeanBase mBeanBase = new MetricsMBeanBase(mr, "test");

    assertEquals(new Long(20), mBeanBase
        .getAttribute(histoName + MetricsHistogram.NUM_OPS_METRIC_NAME));
View Full Code Here

  private MetricsRate metricsRate;
  private MetricsIntValue intValue;
  private MetricsTimeVaryingRate varyRate;

  public void setUp() {
    this.registry = new MetricsRegistry();
    this.metricsRate = new MetricsRate("metricsRate", registry, "test");
    this.intValue = new MetricsIntValue("intValue", registry, "test");
    this.varyRate = new MetricsTimeVaryingRate("varyRate", registry, "test");
    this.stats = new TestStatistics(registry);
    MetricsContext context = MetricsUtil.getContext("hbase");
View Full Code Here

  private MetricsRate metricsRate;
  private MetricsIntValue intValue;
  private MetricsTimeVaryingRate varyRate;

  public void setUp() {
    this.registry = new MetricsRegistry();
    this.metricsRate = new MetricsRate("metricsRate", registry, "test");
    this.intValue = new MetricsIntValue("intValue", registry, "test");
    this.varyRate = new MetricsTimeVaryingRate("varyRate", registry, "test");
    this.stats = new TestStatistics(registry);
    MetricsContext context = MetricsUtil.getContext("hbase");
View Full Code Here

TOP

Related Classes of org.apache.hadoop.metrics.util.MetricsRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.