Package org.apache.hadoop.metrics.util

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


        "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


    final MetricsTimeVaryingRate loginFailure;
    private final MetricsRecord metricsRecord;
    private final MetricsRegistry registry;

    UgiMetrics() {
      registry = new MetricsRegistry();
      loginSuccess = new MetricsTimeVaryingRate("loginSuccess", registry,
          "Rate of successful kerberos logins and time taken in milliseconds");
      loginFailure = new MetricsTimeVaryingRate("loginFailure", registry,
          "Rate of failed kerberos logins and time taken in milliseconds");
      final MetricsContext metricsContext = MetricsUtil.getContext("ugi");
View Full Code Here

   */
  public static void incrLogMetrics(Map<String, Long> incrMetrics) {
    if (incrMetrics == null || incrMetrics.size() == 0) {
      return;
    }
    MetricsRegistry registry = RaidNodeMetrics.getInstance(
        RaidNodeMetrics.DEFAULT_NAMESPACE_ID).getMetricsRegistry();
    Map<String, MetricsTimeVaryingLong> logMetrics = RaidNodeMetrics.getInstance(
        RaidNodeMetrics.DEFAULT_NAMESPACE_ID).logMetrics;
    synchronized(logMetrics) {
      for (String key : incrMetrics.keySet()) {
View Full Code Here

      return;
    }
   
    //Adding to logMetrics
    Group counterGroup = ctrs.getGroup(LogUtils.LOG_COUNTER_GROUP_NAME);
    MetricsRegistry registry = RaidNodeMetrics.getInstance(
        RaidNodeMetrics.DEFAULT_NAMESPACE_ID).getMetricsRegistry();
    Map<String, MetricsTimeVaryingLong> logMetrics = RaidNodeMetrics.getInstance(
        RaidNodeMetrics.DEFAULT_NAMESPACE_ID).logMetrics;
    synchronized(logMetrics) {
      for (Counters.Counter ctr: counterGroup) {
View Full Code Here

public class TestTimeVaryingMetricsMinMax {

  @Test
  public void testBasic() throws Exception {
    MetricsRegistry mr = new MetricsRegistry();
    MetricsTimeVaryingRate metric = new MetricsTimeVaryingRate("test", mr);
    metric.inc(1, 10);

    MetricsContext context = MetricsUtil.getContext("test");
    MetricsRecord metricsRecord = MetricsUtil.createRecord(context, "test");
View Full Code Here

    this.windowLength = windowLength;
    this.numWindows = numWindows;

    MetricsContext context = MetricsUtil.getContext("mapred");
    metricsRecord = MetricsUtil.createRecord(context, "taskerror");
    registry = new MetricsRegistry();

    context.registerUpdater(this);

    URL configURL = null;
    String configFilePath = conf.get(CONFIG_FILE_KEY);
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.