Java Code Examples for org.apache.hadoop.metrics2.lib.MutableCounterLong

The following examples show how to use org.apache.hadoop.metrics2.lib.MutableCounterLong. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hadoop-ozone   Source File: XceiverClientMetrics.java    License: Apache License 2.0 6 votes vote down vote up
public void init() {
  int numEnumEntries = ContainerProtos.Type.values().length;
  this.registry = new MetricsRegistry(SOURCE_NAME);

  this.pendingOpsArray = new MutableCounterLong[numEnumEntries];
  this.opsArray = new MutableCounterLong[numEnumEntries];
  this.containerOpsLatency = new MutableRate[numEnumEntries];
  for (int i = 0; i < numEnumEntries; i++) {
    pendingOpsArray[i] = registry.newCounter(
        "numPending" + ContainerProtos.Type.forNumber(i + 1),
        "number of pending" + ContainerProtos.Type.forNumber(i + 1) + " ops",
        (long) 0);
    opsArray[i] = registry
        .newCounter("opCount" + ContainerProtos.Type.forNumber(i + 1),
            "number of" + ContainerProtos.Type.forNumber(i + 1) + " ops",
            (long) 0);

    containerOpsLatency[i] = registry.newRate(
        ContainerProtos.Type.forNumber(i + 1) + "Latency",
        "latency of " + ContainerProtos.Type.forNumber(i + 1)
        + " ops");
  }
}
 
Example 2
Source Project: hadoop-ozone   Source File: ContainerMetrics.java    License: Apache License 2.0 5 votes vote down vote up
public ContainerMetrics(int[] intervals) {
  int numEnumEntries = ContainerProtos.Type.values().length;
  final int len = intervals.length;
  this.numOpsArray = new MutableCounterLong[numEnumEntries];
  this.opsBytesArray = new MutableCounterLong[numEnumEntries];
  this.opsLatency = new MutableRate[numEnumEntries];
  this.opsLatQuantiles = new MutableQuantiles[numEnumEntries][len];
  this.registry = new MetricsRegistry("StorageContainerMetrics");
  for (int i = 0; i < numEnumEntries; i++) {
    numOpsArray[i] = registry.newCounter(
        "num" + ContainerProtos.Type.forNumber(i + 1),
        "number of " + ContainerProtos.Type.forNumber(i + 1) + " ops",
        (long) 0);
    opsBytesArray[i] = registry.newCounter(
        "bytes" + ContainerProtos.Type.forNumber(i + 1),
        "bytes used by " + ContainerProtos.Type.forNumber(i + 1) + "op",
        (long) 0);
    opsLatency[i] = registry.newRate(
        "latency" + ContainerProtos.Type.forNumber(i + 1),
        ContainerProtos.Type.forNumber(i + 1) + " op");

    for (int j = 0; j < len; j++) {
      int interval = intervals[j];
      String quantileName = ContainerProtos.Type.forNumber(i + 1) + "Nanos"
          + interval + "s";
      opsLatQuantiles[i][j] = registry.newQuantiles(quantileName,
          "latency of Container ops", "ops", "latency", interval);
    }
  }
}
 
Example 3
Source Project: hadoop-ozone   Source File: SCMPipelineMetrics.java    License: Apache License 2.0 5 votes vote down vote up
void createPerPipelineMetrics(Pipeline pipeline) {
  numBlocksAllocated.put(pipeline.getId(), new MutableCounterLong(Interns
      .info(getBlockAllocationMetricName(pipeline),
          "Number of blocks allocated in pipeline " + pipeline.getId()), 0L));
  numBytesWritten.put(pipeline.getId(), new MutableCounterLong(Interns
      .info(getBytesWrittenMetricName(pipeline),
          "Number of bytes written into pipeline " + pipeline.getId()), 0L));
}
 
Example 4
Source Project: hadoop-ozone   Source File: SafeModeMetrics.java    License: Apache License 2.0 4 votes vote down vote up
public MutableCounterLong getNumHealthyPipelinesThreshold() {
  return numHealthyPipelinesThreshold;
}
 
Example 5
Source Project: hadoop-ozone   Source File: SafeModeMetrics.java    License: Apache License 2.0 4 votes vote down vote up
public MutableCounterLong getCurrentHealthyPipelinesCount() {
  return currentHealthyPipelinesCount;
}
 
Example 6
Source Project: hadoop-ozone   Source File: SafeModeMetrics.java    License: Apache License 2.0 4 votes vote down vote up
public MutableCounterLong
    getNumPipelinesWithAtleastOneReplicaReportedThreshold() {
  return numPipelinesWithAtleastOneReplicaReportedThreshold;
}
 
Example 7
Source Project: hadoop-ozone   Source File: SafeModeMetrics.java    License: Apache License 2.0 4 votes vote down vote up
public MutableCounterLong getCurrentPipelinesWithAtleastOneReplicaCount() {
  return currentPipelinesWithAtleastOneReplicaReportedCount;
}
 
Example 8
Source Project: hadoop-ozone   Source File: SafeModeMetrics.java    License: Apache License 2.0 4 votes vote down vote up
public MutableCounterLong getNumContainerWithOneReplicaReportedThreshold() {
  return numContainerWithOneReplicaReportedThreshold;
}
 
Example 9
Source Project: hadoop-ozone   Source File: SafeModeMetrics.java    License: Apache License 2.0 4 votes vote down vote up
public MutableCounterLong getCurrentContainersWithOneReplicaReportedCount() {
  return currentContainersWithOneReplicaReportedCount;
}
 
Example 10
Source Project: hadoop-ozone   Source File: SCMPipelineMetrics.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Increments number of blocks allocated for the pipeline.
 */
void incNumBlocksAllocated(PipelineID pipelineID) {
  Optional.ofNullable(numBlocksAllocated.get(pipelineID)).ifPresent(
      MutableCounterLong::incr);
}
 
Example 11
Source Project: hadoop-ozone   Source File: SCMPipelineMetrics.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Increments the number of total bytes that write into the pipeline.
 */
void incNumPipelineBytesWritten(Pipeline pipeline, long bytes) {
  numBytesWritten.put(pipeline.getId(), new MutableCounterLong(
      Interns.info(getBytesWrittenMetricName(pipeline), "Number of" +
          " bytes written into pipeline " + pipeline.getId()), bytes));
}
 
Example 12
Source Project: hadoop-ozone   Source File: EventWatcherMetrics.java    License: Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
public MutableCounterLong getTrackedEvents() {
  return trackedEvents;
}
 
Example 13
Source Project: hadoop-ozone   Source File: EventWatcherMetrics.java    License: Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
public MutableCounterLong getTimedOutEvents() {
  return timedOutEvents;
}
 
Example 14
Source Project: hadoop-ozone   Source File: EventWatcherMetrics.java    License: Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
public MutableCounterLong getCompletedEvents() {
  return completedEvents;
}
 
Example 15
Source Project: hadoop-ozone   Source File: OzoneManagerSyncMetrics.java    License: Apache License 2.0 4 votes vote down vote up
public MutableCounterLong getNumSnapshotRequests() {
  return numSnapshotRequests;
}
 
Example 16
Source Project: hadoop-ozone   Source File: OzoneManagerSyncMetrics.java    License: Apache License 2.0 4 votes vote down vote up
public MutableCounterLong getNumSnapshotRequestsFailed() {
  return numSnapshotRequestsFailed;
}
 
Example 17
Source Project: hadoop-ozone   Source File: OzoneManagerSyncMetrics.java    License: Apache License 2.0 4 votes vote down vote up
public MutableCounterLong getNumDeltaRequestsFailed() {
  return numDeltaRequestsFailed;
}
 
Example 18
Source Project: hadoop-ozone   Source File: OzoneManagerSyncMetrics.java    License: Apache License 2.0 4 votes vote down vote up
public MutableCounterLong getNumUpdatesInDeltaTotal() {
  return numUpdatesInDeltaTotal;
}
 
Example 19
Source Project: hadoop-ozone   Source File: OzoneManagerSyncMetrics.java    License: Apache License 2.0 4 votes vote down vote up
public MutableCounterLong getNumNonZeroDeltaRequests() {
  return numNonZeroDeltaRequests;
}