()
| 378 | } |
| 379 | |
| 380 | private void execute() throws IOException { |
| 381 | final int nplotted = runGnuplot(query, basepath, plot); |
| 382 | if (query.hasQueryStringParam("json")) { |
| 383 | final HashMap<String, Object> results = new HashMap<String, Object>(); |
| 384 | results.put("plotted", nplotted); |
| 385 | results.put("points", npoints); |
| 386 | // 1.0 returned an empty inner array if the 1st hashset was null, to do |
| 387 | // the same we need to fudge it with an empty set |
| 388 | if (aggregated_tags != null && aggregated_tags.length > 0 && |
| 389 | aggregated_tags[0] == null) { |
| 390 | aggregated_tags[0] = new HashSet<String>(); |
| 391 | } |
| 392 | results.put("etags", aggregated_tags); |
| 393 | results.put("timing", query.processingTimeMillis()); |
| 394 | query.sendReply(JSON.serializeToBytes(results)); |
| 395 | writeFile(query, basepath + ".json", JSON.serializeToBytes(results)); |
| 396 | } else if (query.hasQueryStringParam("png")) { |
| 397 | query.sendFile(basepath + ".png", max_age); |
| 398 | } else { |
| 399 | query.internalError(new Exception("Should never be here!")); |
| 400 | } |
| 401 | |
| 402 | // TODO(tsuna): Expire old files from the on-disk cache. |
| 403 | graphlatency.add(query.processingTimeMillis()); |
| 404 | graphs_generated.incrementAndGet(); |
| 405 | } |
| 406 | |
| 407 | } |
| 408 |
no test coverage detected