Exemple #1
0
        static QFile hamsterfyMetricsFile(int id, QFile metricsFile)
        {
            var hamster = hamsterMetricsFile(id, metricsFile);

            info("starting write to hamster db: " + hamster);
            var db = new Database();

            db.Create(hamster.path());
            var metricCsv       = new CsvStreamer(metricsFile, true);
            var fileMetricNames = rest(list <string>(metricCsv.header()));
            var runs            = new List <int>();

            eachUntilNull(() => metricCsv.next(), jRecord => {
                var record = list <string>(jRecord);
                var run    = int.Parse(first(record));
                runs.Add(run);
                var doubles = array(convert(rest(record), s => STOMetricsWriter.fromMetricCsv(s)));
                var bytes   = new byte[doubles.Length * 8];
                Buffer.BlockCopy(doubles, 0, bytes, 0, bytes.Length);
                db.Insert(runKey(run), bytes);
            });
            db.Insert(METRICS_KEY, serialize(list(fileMetricNames)));
            db.Insert(RUNS_KEY, serialize(runs));
            insertMetricSortedRuns(db);
            db.Close();
            info("done hamster write");
            return(hamster);
        }
Exemple #2
0
 public STOClient(SystemDetailsTable.SystemDetails details, Queue queue)
 {
     this.queue = queue;
     writer     = new STOMetricsWriter(details, true);
     heart      = new Heartbeat(Bootstrap.LOCAL_CLOUD_BROKER, "Tornado.heartbeat.client." + details.id(), 3000);
     heart.initiate();
 }