mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 13:44:05 -08:00
More userfriendly output when we fail to create the tiered storage.
This commit is contained in:
parent
c4e971d7d9
commit
55ca65aa6e
5
main.go
5
main.go
|
@ -48,7 +48,10 @@ func main() {
|
|||
log.Fatalf("Error loading configuration from %s: %v", *configFile, err)
|
||||
}
|
||||
|
||||
ts := metric.NewTieredStorage(5000, 5000, 100, time.Second*30, time.Second*1, time.Second*20, *metricsStoragePath)
|
||||
ts, err := metric.NewTieredStorage(5000, 5000, 100, time.Second*30, time.Second*1, time.Second*20, *metricsStoragePath)
|
||||
if err != nil {
|
||||
log.Fatalf("Error opening storage: %s", err)
|
||||
}
|
||||
go ts.Serve()
|
||||
go func() {
|
||||
notifier := make(chan os.Signal)
|
||||
|
|
|
@ -214,7 +214,10 @@ func vectorComparisonString(expected []string, actual []string) string {
|
|||
func TestExpressions(t *testing.T) {
|
||||
temporaryDirectory := test.NewTemporaryDirectory("rule_expression_tests", t)
|
||||
defer temporaryDirectory.Close()
|
||||
tieredStorage := metric.NewTieredStorage(5000, 5000, 100, time.Second*30, time.Second*1, time.Second*20, temporaryDirectory.Path())
|
||||
tieredStorage, err := metric.NewTieredStorage(5000, 5000, 100, time.Second*30, time.Second*1, time.Second*20, temporaryDirectory.Path())
|
||||
if err != nil {
|
||||
t.Fatalf("Error opening storage: %s", err)
|
||||
}
|
||||
go tieredStorage.Serve()
|
||||
|
||||
ast.SetStorage(tieredStorage)
|
||||
|
|
|
@ -73,13 +73,13 @@ type Storage interface {
|
|||
GetMetricForFingerprint(model.Fingerprint) (m *model.Metric, err error)
|
||||
}
|
||||
|
||||
func NewTieredStorage(appendToMemoryQueueDepth, appendToDiskQueueDepth, viewQueueDepth uint, flushMemoryInterval, writeMemoryInterval, memoryTTL time.Duration, root string) Storage {
|
||||
func NewTieredStorage(appendToMemoryQueueDepth, appendToDiskQueueDepth, viewQueueDepth uint, flushMemoryInterval, writeMemoryInterval, memoryTTL time.Duration, root string) (storage Storage, err error) {
|
||||
diskStorage, err := NewLevelDBMetricPersistence(root)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return
|
||||
}
|
||||
|
||||
return &tieredStorage{
|
||||
storage = &tieredStorage{
|
||||
appendToDiskQueue: make(chan model.Sample, appendToDiskQueueDepth),
|
||||
appendToMemoryQueue: make(chan model.Sample, appendToMemoryQueueDepth),
|
||||
diskStorage: diskStorage,
|
||||
|
@ -90,6 +90,7 @@ func NewTieredStorage(appendToMemoryQueueDepth, appendToDiskQueueDepth, viewQueu
|
|||
viewQueue: make(chan viewJob, viewQueueDepth),
|
||||
writeMemoryInterval: writeMemoryInterval,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (t *tieredStorage) AppendSample(s model.Sample) (err error) {
|
||||
|
|
|
@ -35,10 +35,14 @@ func (t testTieredStorageCloser) Close() {
|
|||
func newTestTieredStorage(t test.Tester) (storage Storage, closer test.Closer) {
|
||||
var directory test.TemporaryDirectory
|
||||
directory = test.NewTemporaryDirectory("test_tiered_storage", t)
|
||||
storage = NewTieredStorage(5000000, 2500, 1000, 5*time.Second, 15*time.Second, 0*time.Second, directory.Path())
|
||||
storage, err := NewTieredStorage(5000000, 2500, 1000, 5*time.Second, 15*time.Second, 0*time.Second, directory.Path())
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Error creating storage: %s", err)
|
||||
}
|
||||
|
||||
if storage == nil {
|
||||
t.Fatalf("%d. storage == nil")
|
||||
t.Fatalf("storage == nil")
|
||||
}
|
||||
|
||||
go storage.Serve()
|
||||
|
|
Loading…
Reference in a new issue