Package org.apache.hadoop.metrics2

Examples of org.apache.hadoop.metrics2.MetricsRecordBuilder


    stringResult = proxy.echo((String)null);
    assertEquals(stringResult, null);
   
    // Check rpcMetrics
    MetricsRecordBuilder rb = getMetrics(server.rpcMetrics.name());
    assertCounter("RpcProcessingTimeNumOps", 3L, rb);
    assertCounterGt("SentBytes", 0L, rb);
    assertCounterGt("ReceivedBytes", 0L, rb);
   
    // Number of calls to echo method should be 2
View Full Code Here


    } finally {
      server.stop();
      if (proxy != null) {
        RPC.stopProxy(proxy);
      }
      MetricsRecordBuilder rb = getMetrics(server.rpcMetrics.name());
      if (expectFailure) {
        assertCounter("RpcAuthorizationFailures", 1, rb);
      } else {
        assertCounter("RpcAuthorizationSuccesses", 1, rb);
      }
View Full Code Here

    checkApps(parentUserSource, 1, 0, 0, 1, 0, 0);
  }

  public static void checkApps(MetricsSource source, int submitted, int pending,
      int running, int completed, int failed, int killed) {
    MetricsRecordBuilder rb = getMetrics(source);
    assertCounter("AppsSubmitted", submitted, rb);
    assertGauge("AppsPending", pending, rb);
    assertGauge("AppsRunning", running, rb);
    assertCounter("AppsCompleted", completed, rb);
    assertCounter("AppsFailed", failed, rb);
View Full Code Here

  public static void checkResources(MetricsSource source, int allocatedMB,
      int allocCtnrs, long aggreAllocCtnrs, long aggreReleasedCtnrs,
      int availableMB, int pendingMB, int pendingCtnrs,
      int reservedMB, int reservedCtnrs) {
    MetricsRecordBuilder rb = getMetrics(source);
    assertGauge("AllocatedMB", allocatedMB, rb);
    assertGauge("AllocatedContainers", allocCtnrs, rb);
    assertCounter("AggregateContainersAllocated", aggreAllocCtnrs, rb);
    assertCounter("AggregateContainersReleased", aggreReleasedCtnrs, rb);
    assertGauge("AvailableMB", availableMB, rb);
View Full Code Here

   */
  @Override
  public void getMetrics(MetricsBuilder metricsBuilder, boolean all) {


    MetricsRecordBuilder mrb = metricsBuilder.addRecord(metricsName)
        .setContext(metricsContext);

    if (regionSources != null) {
      for (MetricsRegionSourceImpl regionMetricSource : regionSources) {
        regionMetricSource.snapshot(mrb, all);
View Full Code Here

   * @param all            push all or only changed?
   */
  @Override
  public void getMetrics(MetricsBuilder metricsBuilder, boolean all) {

    MetricsRecordBuilder mrb = metricsBuilder.addRecord(metricsName)
        .setContext(metricsContext);

    // rsWrap can be null because this function is called inside of init.
    if (rsWrap != null) {
      mrb.addGauge(REGION_COUNT, REGION_COUNT_DESC, rsWrap.getNumOnlineRegions())
          .addGauge(STORE_COUNT, STORE_COUNT_DESC, rsWrap.getNumStores())
          .addGauge(STOREFILE_COUNT, STOREFILE_COUNT_DESC, rsWrap.getNumStoreFiles())
          .addGauge(MEMSTORE_SIZE, MEMSTORE_SIZE_DESC, rsWrap.getMemstoreSize())
          .addGauge(STOREFILE_SIZE, STOREFILE_SIZE_DESC, rsWrap.getStoreFileSize())
          .addGauge(RS_START_TIME_NAME, RS_START_TIME_DESC, rsWrap.getStartCode())
View Full Code Here

        int numSources, numSinks;
        synchronized(MetricsSystemImpl.this) {
          numSources = sources.size();
          numSinks = sinks.size();
        }
        MetricsRecordBuilder rb = builder.addRecord(MS_NAME)
            .setContext(MS_CONTEXT)
            .addGauge(NUM_SOURCES_KEY, NUM_SOURCES_DESC, numSources)
            .addGauge(NUM_SINKS_KEY, NUM_SINKS_DESC, numSinks);
        synchronized(MetricsSystemImpl.this) {
          for (MetricsSinkAdapter sa : sinks.values()) {
View Full Code Here

    stringResult = proxy.echo((String)null);
    assertEquals(stringResult, null);
   
    // Check rpcMetrics
    RpcInstrumentation rpcMetrics = server.rpcMetrics;
    MetricsRecordBuilder rb = getMetrics(rpcMetrics);

    // Number 4 includes getProtocolVersion()
    assertCounter("RpcProcessingTime_num_ops", 4L, rb);
    assertCounterGt("SentBytes", 0L, rb);
    assertCounterGt("ReceivedBytes", 0L, rb);
View Full Code Here

    } finally {
      server.stop();
      if (proxy != null) {
        RPC.stopProxy(proxy);
      }
      MetricsRecordBuilder rb = getMetrics(rpcMetrics);
      if (expectFailure) {
        assertCounter("rpcAuthorizationFailures", 1, rb);
      } else {
        assertCounter("rpcAuthorizationSuccesses", 1, rb);
      }
View Full Code Here

   * @param source  the metrics source
   * @return the record builder mock to verify
   */
  public static MetricsRecordBuilder getMetrics(MetricsSource source) {
    MetricsBuilder mb = mock(MetricsBuilder.class);
    final MetricsRecordBuilder rb = mock(MetricsRecordBuilder.class,
        new Answer<Object>() {
      @Override
      public Object answer(InvocationOnMock invocation) {
        Object[] args = invocation.getArguments();
        StringBuilder sb = new StringBuilder();
View Full Code Here

TOP

Related Classes of org.apache.hadoop.metrics2.MetricsRecordBuilder

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.