use of com.alibaba.jstorm.ui.model.graph.ChartSeries in project jstorm by alibaba.
the class ClusterAPIController method metrics.
@RequestMapping("/metrics")
public Map metrics(@PathVariable String clusterName) {
//we only get the 60s window
int window = 60;
Map ret;
NimbusClient client = null;
try {
client = NimbusClientManager.getNimbusClient(clusterName);
List<MetricInfo> infos = client.getClient().getMetrics(JStormMetrics.CLUSTER_METRIC_KEY, MetaType.TOPOLOGY.getT());
List<ChartSeries> metrics = UIUtils.getChartSeries(infos, window);
ret = new HashMap<>();
ret.put("metrics", metrics);
} catch (Exception e) {
NimbusClientManager.removeClient(clusterName);
ret = UIUtils.exceptionJson(e);
LOG.error(e.getMessage(), e);
}
return ret;
}
use of com.alibaba.jstorm.ui.model.graph.ChartSeries in project jstorm by alibaba.
the class TopologyAPIController method summaryMetrics.
@RequestMapping("/metrics")
public Map summaryMetrics(@PathVariable String clusterName, @PathVariable String topology) {
//we only get the 60s window
int window = 60;
Map<String, Object> ret = new HashMap<>();
NimbusClient client = null;
try {
client = NimbusClientManager.getNimbusClient(clusterName);
List<MetricInfo> infos = client.getClient().getMetrics(topology, MetaType.TOPOLOGY.getT());
List<ChartSeries> metrics = UIUtils.getChartSeries(infos, window);
ret.put("metrics", metrics);
} catch (Exception e) {
NimbusClientManager.removeClient(clusterName);
ret = UIUtils.exceptionJson(e);
LOG.error(e.getMessage(), e);
}
return ret;
}
Aggregations