public static ConfigTtlProvider getInstance() {
return INSTANCE;
}
private ConfigTtlProvider() {
final Configuration config = Configuration.getInstance();
// String rollups
stringTTL = new TimeValue(config.getIntegerProperty(TtlConfig.STRING_METRICS_TTL), TimeUnit.DAYS);
ImmutableTable.Builder<Granularity, RollupType, TimeValue> ttlMapBuilder =
new ImmutableTable.Builder<Granularity, RollupType, TimeValue>();
// Basic rollups
ttlMapBuilder.put(Granularity.FULL, RollupType.BF_BASIC,
new TimeValue(config.getIntegerProperty(TtlConfig.RAW_METRICS_TTL), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_5, RollupType.BF_BASIC,
new TimeValue(config.getIntegerProperty(TtlConfig.BASIC_ROLLUPS_MIN5), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_20, RollupType.BF_BASIC,
new TimeValue(config.getIntegerProperty(TtlConfig.BASIC_ROLLUPS_MIN20), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_60, RollupType.BF_BASIC,
new TimeValue(config.getIntegerProperty(TtlConfig.BASIC_ROLLUPS_MIN60), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_240, RollupType.BF_BASIC,
new TimeValue(config.getIntegerProperty(TtlConfig.BASIC_ROLLUPS_MIN240), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_1440, RollupType.BF_BASIC,
new TimeValue(config.getIntegerProperty(TtlConfig.BASIC_ROLLUPS_MIN1440), TimeUnit.DAYS));
// Histogram rollups
ttlMapBuilder.put(Granularity.MIN_5, RollupType.BF_HISTOGRAMS,
new TimeValue(config.getIntegerProperty(TtlConfig.HIST_ROLLUPS_MIN5), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_20, RollupType.BF_HISTOGRAMS,
new TimeValue(config.getIntegerProperty(TtlConfig.HIST_ROLLUPS_MIN20), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_60, RollupType.BF_HISTOGRAMS,
new TimeValue(config.getIntegerProperty(TtlConfig.HIST_ROLLUPS_MIN60), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_240, RollupType.BF_HISTOGRAMS,
new TimeValue(config.getIntegerProperty(TtlConfig.HIST_ROLLUPS_MIN240), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_1440, RollupType.BF_HISTOGRAMS,
new TimeValue(config.getIntegerProperty(TtlConfig.HIST_ROLLUPS_MIN1440), TimeUnit.DAYS));
/* Pre-aggregated rollups */
// Set rollups
ttlMapBuilder.put(Granularity.FULL, RollupType.SET,
new TimeValue(config.getIntegerProperty(TtlConfig.SET_ROLLUPS_FULL), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_5, RollupType.SET,
new TimeValue(config.getIntegerProperty(TtlConfig.SET_ROLLUPS_MIN5), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_20, RollupType.SET,
new TimeValue(config.getIntegerProperty(TtlConfig.SET_ROLLUPS_MIN20), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_60, RollupType.SET,
new TimeValue(config.getIntegerProperty(TtlConfig.SET_ROLLUPS_MIN60), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_240, RollupType.SET,
new TimeValue(config.getIntegerProperty(TtlConfig.SET_ROLLUPS_MIN240), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_1440, RollupType.SET,
new TimeValue(config.getIntegerProperty(TtlConfig.SET_ROLLUPS_MIN1440), TimeUnit.DAYS));
// Timer rollups
ttlMapBuilder.put(Granularity.FULL, RollupType.TIMER,
new TimeValue(config.getIntegerProperty(TtlConfig.TIMER_ROLLUPS_FULL), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_5, RollupType.TIMER,
new TimeValue(config.getIntegerProperty(TtlConfig.TIMER_ROLLUPS_MIN5), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_20, RollupType.TIMER,
new TimeValue(config.getIntegerProperty(TtlConfig.TIMER_ROLLUPS_MIN20), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_60, RollupType.TIMER,
new TimeValue(config.getIntegerProperty(TtlConfig.TIMER_ROLLUPS_MIN60), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_240, RollupType.TIMER,
new TimeValue(config.getIntegerProperty(TtlConfig.TIMER_ROLLUPS_MIN240), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_1440, RollupType.TIMER,
new TimeValue(config.getIntegerProperty(TtlConfig.TIMER_ROLLUPS_MIN1440), TimeUnit.DAYS));
// Gauge rollups
ttlMapBuilder.put(Granularity.FULL, RollupType.GAUGE,
new TimeValue(config.getIntegerProperty(TtlConfig.GAUGE_ROLLUPS_FULL), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_5, RollupType.GAUGE,
new TimeValue(config.getIntegerProperty(TtlConfig.GAUGE_ROLLUPS_MIN5), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_20, RollupType.GAUGE,
new TimeValue(config.getIntegerProperty(TtlConfig.GAUGE_ROLLUPS_MIN20), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_60, RollupType.GAUGE,
new TimeValue(config.getIntegerProperty(TtlConfig.GAUGE_ROLLUPS_MIN60), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_240, RollupType.GAUGE,
new TimeValue(config.getIntegerProperty(TtlConfig.GAUGE_ROLLUPS_MIN240), TimeUnit.DAYS));
ttlMapBuilder.put(Granularity.MIN_1440, RollupType.GAUGE,
new TimeValue(config.getIntegerProperty(TtlConfig.GAUGE_ROLLUPS_MIN1440), TimeUnit.DAYS));
this.ttlMapper = ttlMapBuilder.build();
}