Search in sources :

Example 1 with Timestamp

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;
}
Also used : Timestamp(io.gravitee.management.model.analytics.Timestamp) FieldBucket(io.gravitee.repository.healthcheck.query.FieldBucket) Bucket(io.gravitee.repository.healthcheck.query.Bucket) HistogramAnalytics(io.gravitee.management.model.analytics.HistogramAnalytics)

Aggregations

HistogramAnalytics (io.gravitee.management.model.analytics.HistogramAnalytics)1 Timestamp (io.gravitee.management.model.analytics.Timestamp)1 Bucket (io.gravitee.repository.healthcheck.query.Bucket)1 FieldBucket (io.gravitee.repository.healthcheck.query.FieldBucket)1