示例#1
0
文件: main.go 项目: pjjw/prometheus
func main() {
	flag.Parse()

	if storageRoot == nil || *storageRoot == "" {
		glog.Fatal("Must provide a path...")
	}

	persistence, err := tiered.NewLevelDBPersistence(*storageRoot)
	if err != nil {
		glog.Fatal(err)
	}
	defer persistence.Close()

	dumper := &SamplesDumper{
		csv.NewWriter(os.Stdout),
	}

	entire, err := persistence.MetricSamples.ForEach(&tiered.MetricSamplesDecoder{}, &tiered.AcceptAllFilter{}, dumper)
	if err != nil {
		glog.Fatal("Error dumping samples: ", err)
	}
	if !entire {
		glog.Fatal("Didn't scan entire corpus")
	}
	dumper.Flush()
	if err = dumper.Error(); err != nil {
		glog.Fatal("Error flushing CSV: ", err)
	}
}
示例#2
0
文件: main.go 项目: pjjw/prometheus
func main() {
	flag.Parse()

	if storageRoot == nil || *storageRoot == "" {
		glog.Fatal("Must provide a path...")
	}

	persistences, err := tiered.NewLevelDBPersistence(*storageRoot)
	if err != nil {
		glog.Fatal(err)
	}
	defer persistences.Close()

	start := time.Now()
	glog.Info("Starting compaction...")
	size, _ := persistences.Sizes()
	glog.Info("Original Size: ", size)
	persistences.Prune()
	glog.Info("Finished in ", time.Since(start))
	size, _ = persistences.Sizes()
	glog.Info("New Size: ", size)
}