use of org.apache.geode.tools.pulse.internal.data.Cluster in project geode by apache.
the class PulseController method dataBrowserExport.
@RequestMapping(value = "/dataBrowserExport", method = RequestMethod.GET)
public void dataBrowserExport(HttpServletRequest request, HttpServletResponse response) throws IOException {
// get query string
String query = request.getParameter("query");
String members = request.getParameter("members");
int limit = 0;
try {
limit = Integer.valueOf(request.getParameter("limit"));
} catch (NumberFormatException e) {
limit = 0;
logger.debug(e);
}
ObjectNode queryResult = mapper.createObjectNode();
try {
if (StringUtils.isNotBlank(query)) {
// get cluster object
Cluster cluster = Repository.get().getCluster();
String userName = request.getUserPrincipal().getName();
// Call execute query method
queryResult = cluster.executeQuery(query, members, limit);
// Add query in history if query is executed successfully
if (!queryResult.has("error")) {
// Add html escaped query to history
String escapedQuery = StringEscapeUtils.escapeHtml(query);
cluster.addQueryInHistory(escapedQuery, userName);
}
}
} catch (Exception e) {
logger.debug("Exception Occurred : ", e);
}
response.setContentType("application/json");
response.setHeader("Content-Disposition", "attachment; filename=results.json");
response.getOutputStream().write(queryResult.toString().getBytes());
}
use of org.apache.geode.tools.pulse.internal.data.Cluster in project geode by apache.
the class ClusterKeyStatisticsService method execute.
public ObjectNode execute(final HttpServletRequest request) throws Exception {
// get cluster object
Cluster cluster = Repository.get().getCluster();
// json object to be sent as response
ObjectNode responseJSON = mapper.createObjectNode();
responseJSON.put("writePerSecTrend", mapper.valueToTree(cluster.getStatisticTrend(Cluster.CLUSTER_STAT_WRITES_PER_SECOND)));
responseJSON.put("readPerSecTrend", mapper.valueToTree(cluster.getStatisticTrend(Cluster.CLUSTER_STAT_READ_PER_SECOND)));
responseJSON.put("queriesPerSecTrend", mapper.valueToTree(cluster.getStatisticTrend(Cluster.CLUSTER_STAT_QUERIES_PER_SECOND)));
// Send json response
return responseJSON;
}
use of org.apache.geode.tools.pulse.internal.data.Cluster in project geode by apache.
the class ClusterGCPausesService method execute.
public ObjectNode execute(final HttpServletRequest request) throws Exception {
// get cluster object
Cluster cluster = Repository.get().getCluster();
// json object to be sent as response
ObjectNode responseJSON = mapper.createObjectNode();
// cluster's GC Pauses trend added to json response object
ArrayNode pauses = mapper.createArrayNode();
for (Object obj : cluster.getStatisticTrend(Cluster.CLUSTER_STAT_GARBAGE_COLLECTION)) {
if (obj instanceof Number) {
pauses.add(((Number) obj).longValue());
}
}
responseJSON.put("currentGCPauses", cluster.getGarbageCollectionCount());
responseJSON.put("gCPausesTrend", pauses);
// Send json response
return responseJSON;
}
Aggregations