Package com.rackspacecloud.blueflood.service

Examples of com.rackspacecloud.blueflood.service.Configuration


    }

    @Override
    public void startService(ScheduleContext context, IMetricsWriter writer) {
    
        final Configuration config = Configuration.getInstance();
       
        final IngestApplication ingestApplication = new IngestApplication();
        final Bootstrap<IngestConfiguration> bootstrap = new Bootstrap<IngestConfiguration>(ingestApplication) {
           
            // we want to bring our own MetricRegistry. The only downside to this is that we miss a few JVM metrics
            // that get registered by DW. See https://github.com/dropwizard/dropwizard/pull/548 for more info.
            @Override
            public MetricRegistry getMetricRegistry() {
                return Metrics.getRegistry();
            }
        };
       
        bootstrap.setConfigurationSourceProvider(new ConfigurationSourceProvider() {
            @Override
            public InputStream open(String path) throws IOException {
               
               
                String replaced = String.format(YAML,
                        // gotta use strings, because I don't want to depend on the http module.
                        config.getStringProperty("HTTP_INGESTION_HOST"),
                        config.getStringProperty("HTTP_INGESTION_PORT"),
                        config.getStringProperty("HTTP_INGESTION_HOST"),
                        Integer.toString(Integer.parseInt(config.getStringProperty("HTTP_INGESTION_PORT"))+1),
                        makeSafeYamlList(config.getStringProperty(CoreConfig.CASSANDRA_HOSTS), ","),
                        config.getStringProperty(CoreConfig.ROLLUP_KEYSPACE),
                        config.getStringProperty(CoreConfig.IMETRICS_WRITER),
                        "false");
                return new ByteArrayInputStream(replaced.getBytes(Charsets.UTF_8));
            }
        });
       
View Full Code Here


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

import com.rackspacecloud.blueflood.service.Configuration;

public class RunRollupTool {

    public static void main(String args[]) {
        Configuration conf = Configuration.getInstance();
        String newPrefix = conf.getStringProperty("GRAPHITE_HOST") + ".rollupTool";
        System.setProperty(conf.getStringProperty("GRAPHITE_HOST").toString(), newPrefix);
        ManualRollup rollupTool = new ManualRollup();
        rollupTool.startManualRollup();
    }
View Full Code Here

    private final ThreadPoolExecutor executor;
    private final TimeValue queryTimeout;
    private final int maxMetricsPerRequest;

    public HttpMultiRollupsQueryHandler() {
        Configuration config = Configuration.getInstance();
        int maxThreadsToUse = config.getIntegerProperty(HttpConfig.MAX_READ_WORKER_THREADS);
        int maxQueueSize = config.getIntegerProperty(HttpConfig.MAX_BATCH_READ_REQUESTS_TO_QUEUE);
        this.queryTimeout = new TimeValue(
                config.getIntegerProperty(HttpConfig.BATCH_QUERY_TIMEOUT),
                TimeUnit.SECONDS
        );
        this.maxMetricsPerRequest = config.getIntegerProperty(HttpConfig.MAX_METRICS_PER_BATCH_QUERY);
        this.serializer = new BatchedMetricsJSONOutputSerializer();
        this.gson = new GsonBuilder().setPrettyPrinting().serializeNulls().create();
        this.parser = new JsonParser();
        this.executor = new ThreadPoolBuilder().withCorePoolSize(maxThreadsToUse).withMaxPoolSize(maxThreadsToUse)
                .withName("HTTP-BatchMetricsFetch").withBoundedQueue(maxQueueSize).build();
View Full Code Here

public class ConfigTtlProviderTest {
    @Test
    public void testConfigTtl() throws Exception {
        final ConfigTtlProvider ttlProvider = ConfigTtlProvider.getInstance();
        final Configuration config = Configuration.getInstance();

        Assert.assertTrue(new TimeValue(config.getIntegerProperty(TtlConfig.RAW_METRICS_TTL), TimeUnit.DAYS).equals(
                ttlProvider.getTTL("acFoo", Granularity.FULL, RollupType.BF_BASIC)));

        // Ask for an invalid combination of granularity and rollup type
        try {
            Assert.assertNull(ttlProvider.getTTL("acBar", Granularity.FULL, RollupType.BF_HISTOGRAMS));
View Full Code Here

    }

    @Test
    public void testConfigTtlForStrings() throws Exception {
        final ConfigTtlProvider ttlProvider = ConfigTtlProvider.getInstance();
        final Configuration config = Configuration.getInstance();

        Assert.assertTrue(new TimeValue(config.getIntegerProperty(TtlConfig.STRING_METRICS_TTL), TimeUnit.DAYS).equals(
                ttlProvider.getTTLForStrings("acFoo")));
    }
View Full Code Here

TOP

Related Classes of com.rackspacecloud.blueflood.service.Configuration

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.