コード例 #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();
    }
  }
コード例 #2
0
  @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();
    }
  }
コード例 #3
0
ファイル: FSQueueMetrics.java プロジェクト: imace/hops
  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;
  }
コード例 #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;
 }
コード例 #5
0
 public static MetricsSource queueSource(MetricsSystem ms, String queue) {
   MetricsSource s = ms.getSource(QueueMetrics.sourceName(queue).toString());
   return s;
 }
コード例 #6
0
ファイル: TestFileSink.java プロジェクト: RiseOfApes/hadoop
 public MyMetrics2 registerWith(MetricsSystem ms) {
   return ms.register("m2", null, this);
 }
コード例 #7
0
 PullServerAuxService(MetricsSystem ms) {
   super("httpshuffle");
   metrics = ms.register(new ShuffleMetrics());
 }