use of io.gravitee.management.model.analytics.Timestamp in project gravitee-management-rest-api by gravitee-io.
the class HealthCheckServiceImpl method convert.
private HistogramAnalytics convert(DateHistogramResponse histogramResponse) {
final HistogramAnalytics analytics = new HistogramAnalytics();
final List<Long> timestamps = histogramResponse.timestamps();
if (timestamps != null && timestamps.size() > 1) {
final long from = timestamps.get(0);
final long interval = timestamps.get(1) - from;
final long to = timestamps.get(timestamps.size() - 1);
analytics.setTimestamp(new Timestamp(from, to, interval));
List<io.gravitee.management.model.analytics.Bucket> buckets = new ArrayList<>(histogramResponse.values().size());
for (io.gravitee.repository.analytics.query.response.histogram.Bucket bucket : histogramResponse.values()) {
io.gravitee.management.model.analytics.Bucket analyticsBucket = convertBucket(histogramResponse.timestamps(), from, interval, bucket);
buckets.add(analyticsBucket);
}
analytics.setValues(buckets);
}
return analytics;
}
Aggregations