Java 类org.apache.hadoop.hdfs.server.namenode.top.window.RollingWindowManager 实例源码

项目:hadoop    文件:FSNamesystem.java   
@Override // FSNamesystemMBean
public String getTopUserOpCounts() {
  if (!topConf.isEnabled) {
    return null;
  }

  Date now = new Date();
  final List<RollingWindowManager.TopWindow> topWindows =
      topMetrics.getTopWindows();
  Map<String, Object> topMap = new TreeMap<String, Object>();
  topMap.put("windows", topWindows);
  topMap.put("timestamp", DFSUtil.dateToIso8601String(now));
  ObjectMapper mapper = new ObjectMapper();
  try {
    return mapper.writeValueAsString(topMap);
  } catch (IOException e) {
    LOG.warn("Failed to fetch TopUser metrics", e);
  }
  return null;
}
项目:aliyun-oss-hadoop-fs    文件:FSNamesystem.java   
@Override // FSNamesystemMBean
public String getTopUserOpCounts() {
  if (!topConf.isEnabled) {
    return null;
  }

  Date now = new Date();
  final List<RollingWindowManager.TopWindow> topWindows =
      topMetrics.getTopWindows();
  Map<String, Object> topMap = new TreeMap<String, Object>();
  topMap.put("windows", topWindows);
  topMap.put("timestamp", DFSUtil.dateToIso8601String(now));
  ObjectMapper mapper = new ObjectMapper();
  try {
    return mapper.writeValueAsString(topMap);
  } catch (IOException e) {
    LOG.warn("Failed to fetch TopUser metrics", e);
  }
  return null;
}
项目:big-c    文件:FSNamesystem.java   
@Override // FSNamesystemMBean
public String getTopUserOpCounts() {
  if (!topConf.isEnabled) {
    return null;
  }

  Date now = new Date();
  final List<RollingWindowManager.TopWindow> topWindows =
      topMetrics.getTopWindows();
  Map<String, Object> topMap = new TreeMap<String, Object>();
  topMap.put("windows", topWindows);
  topMap.put("timestamp", DFSUtil.dateToIso8601String(now));
  ObjectMapper mapper = new ObjectMapper();
  try {
    return mapper.writeValueAsString(topMap);
  } catch (IOException e) {
    LOG.warn("Failed to fetch TopUser metrics", e);
  }
  return null;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSNamesystem.java   
@Override // FSNamesystemMBean
public String getTopUserOpCounts() {
  if (!topConf.isEnabled) {
    return null;
  }

  Date now = new Date();
  final List<RollingWindowManager.TopWindow> topWindows =
      topMetrics.getTopWindows();
  Map<String, Object> topMap = new TreeMap<String, Object>();
  topMap.put("windows", topWindows);
  topMap.put("timestamp", DFSUtil.dateToIso8601String(now));
  ObjectMapper mapper = new ObjectMapper();
  try {
    return mapper.writeValueAsString(topMap);
  } catch (IOException e) {
    LOG.warn("Failed to fetch TopUser metrics", e);
  }
  return null;
}
项目:hadoop    文件:TopMetrics.java   
public TopMetrics(Configuration conf, int[] reportingPeriods) {
  logConf(conf);
  for (int i = 0; i < reportingPeriods.length; i++) {
    rollingWindowManagers.put(reportingPeriods[i], new RollingWindowManager(
        conf, reportingPeriods[i]));
  }
}
项目:hadoop    文件:TopMetrics.java   
/**
 * Get a list of the current TopWindow statistics, one TopWindow per tracked
 * time interval.
 */
public List<TopWindow> getTopWindows() {
  long monoTime = Time.monotonicNow();
  List<TopWindow> windows = Lists.newArrayListWithCapacity
      (rollingWindowManagers.size());
  for (Entry<Integer, RollingWindowManager> entry : rollingWindowManagers
      .entrySet()) {
    TopWindow window = entry.getValue().snapshot(monoTime);
    windows.add(window);
  }
  return windows;
}
项目:hadoop    文件:TopMetrics.java   
public void report(long currTime, String userName, String cmd) {
  LOG.debug("a metric is reported: cmd: {} user: {}", cmd, userName);
  userName = UserGroupInformation.trimLoginMethod(userName);
  for (RollingWindowManager rollingWindowManager : rollingWindowManagers
      .values()) {
    rollingWindowManager.recordMetric(currTime, cmd, userName, 1);
    rollingWindowManager.recordMetric(currTime,
        TopConf.ALL_CMDS, userName, 1);
  }
}
项目:aliyun-oss-hadoop-fs    文件:TopMetrics.java   
public TopMetrics(Configuration conf, int[] reportingPeriods) {
  logConf(conf);
  for (int i = 0; i < reportingPeriods.length; i++) {
    rollingWindowManagers.put(reportingPeriods[i], new RollingWindowManager(
        conf, reportingPeriods[i]));
  }
}
项目:aliyun-oss-hadoop-fs    文件:TopMetrics.java   
/**
 * Get a list of the current TopWindow statistics, one TopWindow per tracked
 * time interval.
 */
public List<TopWindow> getTopWindows() {
  long monoTime = Time.monotonicNow();
  List<TopWindow> windows = Lists.newArrayListWithCapacity
      (rollingWindowManagers.size());
  for (Entry<Integer, RollingWindowManager> entry : rollingWindowManagers
      .entrySet()) {
    TopWindow window = entry.getValue().snapshot(monoTime);
    windows.add(window);
  }
  return windows;
}
项目:aliyun-oss-hadoop-fs    文件:TopMetrics.java   
public void report(long currTime, String userName, String cmd) {
  LOG.debug("a metric is reported: cmd: {} user: {}", cmd, userName);
  userName = UserGroupInformation.trimLoginMethod(userName);
  for (RollingWindowManager rollingWindowManager : rollingWindowManagers
      .values()) {
    rollingWindowManager.recordMetric(currTime, cmd, userName, 1);
    rollingWindowManager.recordMetric(currTime,
        TopConf.ALL_CMDS, userName, 1);
  }
}
项目:big-c    文件:TopMetrics.java   
public TopMetrics(Configuration conf, int[] reportingPeriods) {
  logConf(conf);
  for (int i = 0; i < reportingPeriods.length; i++) {
    rollingWindowManagers.put(reportingPeriods[i], new RollingWindowManager(
        conf, reportingPeriods[i]));
  }
}
项目:big-c    文件:TopMetrics.java   
/**
 * Get a list of the current TopWindow statistics, one TopWindow per tracked
 * time interval.
 */
public List<TopWindow> getTopWindows() {
  long monoTime = Time.monotonicNow();
  List<TopWindow> windows = Lists.newArrayListWithCapacity
      (rollingWindowManagers.size());
  for (Entry<Integer, RollingWindowManager> entry : rollingWindowManagers
      .entrySet()) {
    TopWindow window = entry.getValue().snapshot(monoTime);
    windows.add(window);
  }
  return windows;
}
项目:big-c    文件:TopMetrics.java   
public void report(long currTime, String userName, String cmd) {
  LOG.debug("a metric is reported: cmd: {} user: {}", cmd, userName);
  userName = UserGroupInformation.trimLoginMethod(userName);
  for (RollingWindowManager rollingWindowManager : rollingWindowManagers
      .values()) {
    rollingWindowManager.recordMetric(currTime, cmd, userName, 1);
    rollingWindowManager.recordMetric(currTime,
        TopConf.ALL_CMDS, userName, 1);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TopMetrics.java   
public TopMetrics(Configuration conf, int[] reportingPeriods) {
  logConf(conf);
  for (int i = 0; i < reportingPeriods.length; i++) {
    rollingWindowManagers.put(reportingPeriods[i], new RollingWindowManager(
        conf, reportingPeriods[i]));
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TopMetrics.java   
/**
 * Get a list of the current TopWindow statistics, one TopWindow per tracked
 * time interval.
 */
public List<TopWindow> getTopWindows() {
  long monoTime = Time.monotonicNow();
  List<TopWindow> windows = Lists.newArrayListWithCapacity
      (rollingWindowManagers.size());
  for (Entry<Integer, RollingWindowManager> entry : rollingWindowManagers
      .entrySet()) {
    TopWindow window = entry.getValue().snapshot(monoTime);
    windows.add(window);
  }
  return windows;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TopMetrics.java   
public void report(long currTime, String userName, String cmd) {
  LOG.debug("a metric is reported: cmd: {} user: {}", cmd, userName);
  userName = UserGroupInformation.trimLoginMethod(userName);
  for (RollingWindowManager rollingWindowManager : rollingWindowManagers
      .values()) {
    rollingWindowManager.recordMetric(currTime, cmd, userName, 1);
    rollingWindowManager.recordMetric(currTime,
        TopConf.ALL_CMDS, userName, 1);
  }
}