use of net.opentsdb.rollup.NoSuchRollupForIntervalException in project opentsdb by OpenTSDB.
the class TsdbQuery method transformDownSamplerToRollupQuery.
/**
* Transform downsampler properties to rollup properties, if the rollup
* is enabled at configuration level and down sampler is set.
* It falls back to raw data and down sampling if there is no
* RollupInterval is configured against this down sample interval
* @param group_by The group by aggregator.
* @param str_interval String representation of the interval, for logging
* @since 2.4
*/
public void transformDownSamplerToRollupQuery(final Aggregator group_by, final String str_interval) {
if (downsampler != null && downsampler.getInterval() > 0) {
if (tsdb.getRollupConfig() != null) {
try {
best_match_rollups = tsdb.getRollupConfig().getRollupInterval(downsampler.getInterval() / 1000, str_interval);
// It is thread safe as each thread will be working on unique
// TsdbQuery object
// RollupConfig.getRollupInterval guarantees that,
// it always return a non-empty list
// TODO
rollup_query = new RollupQuery(best_match_rollups.remove(0), downsampler.getFunction(), downsampler.getInterval(), group_by);
} catch (NoSuchRollupForIntervalException nre) {
LOG.error("There is no such rollup for the downsample interval " + str_interval + ". So fall back to the default tsdb down" + " sampling approach and it requires raw data scan.");
// nullify the rollup_query if this api is called explicitly
rollup_query = null;
return;
}
if (rollup_query.getRollupInterval().isDefaultInterval()) {
// Anyways it is a scan on raw data
rollup_query = null;
}
}
}
}
Aggregations