Package com.rackspacecloud.blueflood.utils

Examples of com.rackspacecloud.blueflood.utils.TimeValue


    public static Collection<Metric> remarshal(Collection<BasicMetric> basicMetrics, String tenantId) {
        List<Metric> metrics = new ArrayList<Metric>(basicMetrics.size());
        for (BasicMetric bm : basicMetrics) {
            String appliedTenantId = tenantId == null ? bm.getTenant() : tenantId;
            Locator locator = Locator.createLocatorFromPathComponents(appliedTenantId, splitForLocator(bm.getMetricName()));
            Metric m = new Metric(locator, bm.getMetricValue(), bm.getCollectionTime(), new TimeValue(bm.getTtlInSeconds(), TimeUnit.SECONDS), bm.getUnit());
            metrics.add(m);
        }
        return metrics;
    }
View Full Code Here


    AstyanaxWriter writer = AstyanaxWriter.getInstance();

    @Before
    public void setUp() throws Exception{
        super.setUp();
        final TimeValue ttl = new TimeValue(48, TimeUnit.HOURS);

        // put some full resolution data.
        Collection<IMetric> normalMetrics = new ArrayList<IMetric>();
        long time = Granularity.MIN_5.milliseconds()/2;
View Full Code Here

                locator = Locator.createLocatorFromPathComponents(tenantId, jsonMetric.getMetricName());
            }

            if (jsonMetric.getMetricValue() != null) {
                final Metric metric = new Metric(locator, jsonMetric.getMetricValue(), jsonMetric.getCollectionTime(),
                        new TimeValue(jsonMetric.getTtlInSeconds(), TimeUnit.SECONDS), jsonMetric.getUnit());
                metrics.add(metric);
            }
        }

        return metrics;
View Full Code Here

public class ShardStatePuller extends ShardStateWorker {
    private static final Logger log = LoggerFactory.getLogger(ShardStatePuller.class);
   

    public ShardStatePuller(Collection<Integer> allShards, ShardStateManager stateManager, ShardStateIO io) {
        super(allShards, stateManager, new TimeValue(Configuration.getInstance().getIntegerProperty(CoreConfig.SHARD_PULL_PERIOD), TimeUnit.MILLISECONDS), io);
    }
View Full Code Here

    public Locator getLocator() { return locator; }
    public long getCollectionTime() { return collectionTime; }
    public int getTtlInSeconds() { return (int)ttl.toSeconds(); }
    public Rollup getMetricValue() { return value; }
    public void setTtlInSeconds(int seconds) { ttl = new TimeValue(seconds, TimeUnit.SECONDS); }
View Full Code Here

    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();
    }
View Full Code Here

        this.ttlMapper = ttlMapBuilder.build();
    }

    @Override
    public TimeValue getTTL(String tenantId, Granularity gran, RollupType rollupType) throws Exception {
        final TimeValue ttl = ttlMapper.get(gran, rollupType);

        if (ttl == null) {
            log.warn("No valid TTL entry for granularity: " + gran + ", rollup type: " + rollupType.name()
                    + " in config. Resorting to safe TTL values.");
            throw new ConfigException("No TTL config found for granularity: " + gran
View Full Code Here

                try {
                    ColumnFamily cf = CassandraModel.getColumnFamily(RollupType.classOf(type, granularity), granularity);

                    if (cf instanceof CassandraModel.MetricColumnFamily) {
                        CassandraModel.MetricColumnFamily metricCF = (CassandraModel.MetricColumnFamily) cf;
                        TimeValue ttl = new TimeValue(metricCF.getDefaultTTL().getValue() * 5, metricCF.getDefaultTTL().getUnit());
                        ttlMapBuilder.put(granularity, type, ttl);
                    }
                } catch (IllegalArgumentException ex) {
                    // pass
                }
View Full Code Here

            .build());


        // RollupRunnable keeps a static one of these. It would be nice if we could register it and share.
        MetadataCache rollupTypeCache = MetadataCache.createLoadingCacheInstance(
                new TimeValue(48, TimeUnit.HOURS),
                Configuration.getInstance().getIntegerProperty(CoreConfig.MAX_ROLLUP_READ_THREADS));
        rollupTypeCacher = new RollupTypeCacher(
                new ThreadPoolBuilder().withName("Rollup type persistence").build(),
                rollupTypeCache,
                true
View Full Code Here

                "fooService,fooServer," + randString(8));

        final List<Metric> metrics = new ArrayList<Metric>();
        for (int i = 0; i < 100; i++) {
            final Metric metric = new Metric(locator, i, baseMillis + (i * 1000),
                    new TimeValue(1, TimeUnit.DAYS), "unknown");
            metrics.add(metric);
            writer.insertFull(metrics);
            metrics.clear();
        }
       
View Full Code Here

TOP

Related Classes of com.rackspacecloud.blueflood.utils.TimeValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.