Ejemplo n.º 1
0
  @Test
  public void testMetricsCache() {
    MetricsSystem ms = new MetricsSystemImpl("cache");
    ms.start();

    try {
      String p1 = "root1";
      String leafQueueName = "root1.leaf";

      QueueMetrics p1Metrics = QueueMetrics.forQueue(ms, p1, null, true, conf);
      Queue parentQueue1 = make(stub(Queue.class).returning(p1Metrics).from.getMetrics());
      QueueMetrics metrics = QueueMetrics.forQueue(ms, leafQueueName, parentQueue1, true, conf);

      Assert.assertNotNull("QueueMetrics for A shoudn't be null", metrics);

      // Re-register to check for cache hit, shouldn't blow up metrics-system...
      // also, verify parent-metrics
      QueueMetrics alterMetrics =
          QueueMetrics.forQueue(ms, leafQueueName, parentQueue1, true, conf);

      Assert.assertNotNull("QueueMetrics for alterMetrics shoudn't be null", alterMetrics);
    } finally {
      ms.shutdown();
    }
  }
  @After
  public void tearDown() {
    if (hostFile != null && hostFile.exists()) {
      hostFile.delete();
    }

    ClusterMetrics.destroy();
    if (rm != null) {
      rm.stop();
    }

    MetricsSystem ms = DefaultMetricsSystem.instance();
    if (ms.getSource("ClusterMetrics") != null) {
      DefaultMetricsSystem.shutdown();
    }
  }
Ejemplo n.º 3
0
  public static synchronized FSQueueMetrics forQueue(
      String queueName, Queue parent, boolean enableUserMetrics, Configuration conf) {
    MetricsSystem ms = DefaultMetricsSystem.instance();
    QueueMetrics metrics = queueMetrics.get(queueName);
    if (metrics == null) {
      metrics =
          new FSQueueMetrics(ms, queueName, parent, enableUserMetrics, conf)
              .tag(QUEUE_INFO, queueName);

      // Register with the MetricsSystems
      if (ms != null) {
        metrics =
            ms.register(
                sourceName(queueName).toString(), "Metrics for queue: " + queueName, metrics);
      }
      queueMetrics.put(queueName, metrics);
    }

    return (FSQueueMetrics) metrics;
  }
Ejemplo n.º 4
0
 public static MetricsSource userSource(MetricsSystem ms, String queue, String user) {
   MetricsSource s =
       ms.getSource(QueueMetrics.sourceName(queue).append(",user=").append(user).toString());
   return s;
 }
Ejemplo n.º 5
0
 public static MetricsSource queueSource(MetricsSystem ms, String queue) {
   MetricsSource s = ms.getSource(QueueMetrics.sourceName(queue).toString());
   return s;
 }
Ejemplo n.º 6
0
 public MyMetrics2 registerWith(MetricsSystem ms) {
   return ms.register("m2", null, this);
 }
 PullServerAuxService(MetricsSystem ms) {
   super("httpshuffle");
   metrics = ms.register(new ShuffleMetrics());
 }