mirror of
https://github.com/prometheus/prometheus
synced 2025-03-09 23:17:40 +00:00
Try to create metrics root directory if missing
This change tries to be nice and create the metrics directoy first before erroring out. Change-Id: I72691cdc32469708cd671c6ef1fb7db55fe60430
This commit is contained in:
parent
4300ce3dc8
commit
6947ee9bc9
@ -15,6 +15,7 @@ package metric
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
"sync"
|
||||
"time"
|
||||
@ -114,7 +115,9 @@ const watermarkCacheLimit = 1024 * 1024
|
||||
|
||||
func NewTieredStorage(appendToDiskQueueDepth, viewQueueDepth uint, flushMemoryInterval time.Duration, memoryTTL time.Duration, rootDirectory string) (*TieredStorage, error) {
|
||||
if isDir, _ := utility.IsDir(rootDirectory); !isDir {
|
||||
return nil, fmt.Errorf("Could not find metrics directory %s", rootDirectory)
|
||||
if err := os.MkdirAll(rootDirectory, 0755); err != nil {
|
||||
return nil, fmt.Errorf("Could not find or create metrics directory %s: %s", rootDirectory, err)
|
||||
}
|
||||
}
|
||||
|
||||
diskStorage, err := NewLevelDBMetricPersistence(rootDirectory)
|
||||
|
Loading…
Reference in New Issue
Block a user