@Override public void visitMetricItem(MetricItem metricItem) { m_id = metricItem.getId(); m_type = metricItem.getType(); super.visitMetricItem(metricItem); }
private void updateInterface(Interface inter, int minute) { String group = inter.getGroup(); String domain = inter.getDomain(); String key = inter.getKey(); long period; minute -= DATA_DELAY_TIME; if (minute >= 0) { period = ModelPeriod.CURRENT.getStartTime(); } else { period = ModelPeriod.LAST.getStartTime(); minute += 60; } try { ModelRequest request = new ModelRequest(group, period); MetricReport report = m_service.invoke(request); if (report != null) { MetricItem inItem = report.findOrCreateMetricItem(domain + ":Metric:" + key + "-in"); MetricItem outItem = report.findOrCreateMetricItem(domain + ":Metric:" + key + "-out"); inter.setIn(inItem.findOrCreateSegment(minute).getSum() / 60 * 8); inter.setOut(outItem.findOrCreateSegment(minute).getSum() / 60 * 8); } } catch (Exception e) { Cat.logError(e); } }