org.apache.hadoop.metrics.util.MetricsIntValue Java Examples

The following examples show how to use org.apache.hadoop.metrics.util.MetricsIntValue. 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 File: ClusterManagerMetrics.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor.
 * @param types The available resource types.
 */
public ClusterManagerMetrics(Collection<ResourceType> types) {
  context = MetricsUtil.getContext(CONTEXT_NAME);
  metricsRecord = MetricsUtil.createRecord(context, CONTEXT_NAME);
  typeToResourceRequested = createTypeToResourceCountMap(types, "requested");
  typeToResourceGranted = createTypeToResourceCountMap(types, "granted");
  typeToResourceRevoked = createTypeToResourceCountMap(types, "revoked");
  typeToResourceReleased = createTypeToResourceCountMap(types, "released");
  typeToPendingCount = createTypeToCountMap(types, "pending");
  typeToRunningCount = createTypeToCountMap(types, "running");
  typeToTotalSlots = createTypeToCountMap(types, "total");
  typeToFreeSlots = createTypeToCountMap(types, "free");
  typeToSchedulerRunTime = createTypeToCountMap(types, "scheduler_runtime");
  sessionStatusToMetrics = createSessionStatusToMetricsMap();
  aliveNodes = new MetricsIntValue("alive_nodes", registry);
  deadNodes = new MetricsIntValue("dead_nodes", registry);
  blacklistedNodes = new MetricsIntValue("blacklisted_nodes", registry);
  numRunningSessions = new MetricsIntValue("num_running_sessions", registry);
  totalSessionCount = new MetricsTimeVaryingInt("total_sessions", registry);
  pendingCallsCount = new MetricsIntValue("num_pending_calls", registry);
  numCJTFailures = new MetricsTimeVaryingInt("num_cjt_failures", registry);
}
 
Example #2
Source File: ClusterManagerMetrics.java    From RDFS with Apache License 2.0 5 votes vote down vote up
/**
 * Create a map of resource type -> current count.
 * @param resourceTypes The resource types.
 * @param actionType A string indicating pending, running etc.
 * @return The map.
 */
private Map<ResourceType, MetricsIntValue> createTypeToCountMap(
    Collection<ResourceType> resourceTypes, String actionType) {
  Map<ResourceType, MetricsIntValue> m =
      new HashMap<ResourceType, MetricsIntValue>();
  for (ResourceType t : resourceTypes) {
    String name = (actionType + "_" + t).toLowerCase();
    MetricsIntValue value = new MetricsIntValue(name, registry);
    m.put(t, value);
  }
  return m;
}