use of com.alibaba.jstorm.ui.model.graph.TopologyGraph in project jstorm by alibaba.
the class TopologyAPIController method graph.
@RequestMapping("/graph")
public Map graph(@PathVariable String clusterName, @PathVariable String topology) {
Map<String, Object> result = new HashMap<>();
NimbusClient client = null;
try {
client = NimbusClientManager.getNimbusClient(clusterName);
StormTopology stormTopology = client.getClient().getTopology(topology);
int size = componentSize(stormTopology);
if (size < 100) {
List<MetricInfo> componentMetrics = client.getClient().getMetrics(topology, MetaType.COMPONENT.getT());
TopologyGraph graph = UIUtils.getTopologyGraph(stormTopology, componentMetrics);
result.put("graph", graph);
} else {
result.put("error", "too many components, please check your topology first!");
}
} catch (Exception e) {
NimbusClientManager.removeClient(clusterName);
LOG.error(e.getMessage(), e);
result = UIUtils.exceptionJson(e);
}
return result;
}
Aggregations