Exemple #1
0
 public List<TimeMeasurement> getTimeMeasurements(
     int procedureId, DateTime fromDate, DateTime toDate, int buckets)
     throws NoSuchElementException {
   List<TimeMeasurement> timeMeasurements =
       getTimeMeasurements(procedureId, fromDate, toDate, TimeMeasurement.Field.TIMESTAMP);
   if (buckets > 0) {
     timeMeasurements = analyzer.splitIntoBuckets(timeMeasurements, fromDate, toDate, buckets);
   }
   return timeMeasurements;
 }
Exemple #2
0
  public Map<String, Object> getPercentileByProcedure(
      int procedureId, DateTime fromDate, DateTime toDate, int[] percentages) {
    Map<String, Object> percentilesMap = Maps.newHashMap();

    List<TimeMeasurement> timeMeasurements =
        logRepository.getTimeMeasurementsByProcedure(
            fromDate,
            toDate,
            logRepository.getProcedure(procedureId),
            TimeMeasurement.Field.DURATION);
    Map<Integer, String> percentiles = Maps.newHashMap();

    for (int i = 0; i < percentages.length; i++) {
      String percentile =
          new Duration((long) analyzer.percentile(timeMeasurements, percentages[i])).toString();
      percentiles.put(percentages[i], percentile);
    }
    percentilesMap.put("id", procedureId);
    percentilesMap.put("percentiles", percentiles);
    return percentilesMap;
  }