mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
*: pass Prometheus registry into storage
This commit is contained in:
parent
cc0ff26f1f
commit
4397b4d508
|
@ -70,6 +70,13 @@ func Main() int {
|
|||
return 0
|
||||
}
|
||||
|
||||
// go func() {
|
||||
// for {
|
||||
// time.Sleep(30 * time.Second)
|
||||
// debug.FreeOSMemory()
|
||||
// }
|
||||
// }()
|
||||
|
||||
log.Infoln("Starting prometheus", version.Info())
|
||||
log.Infoln("Build context", version.BuildContext())
|
||||
|
||||
|
@ -78,7 +85,7 @@ func Main() int {
|
|||
reloadables []Reloadable
|
||||
)
|
||||
|
||||
localStorage, err := tsdb.Open(cfg.localStoragePath, &cfg.tsdb)
|
||||
localStorage, err := tsdb.Open(cfg.localStoragePath, prometheus.DefaultRegisterer, &cfg.tsdb)
|
||||
if err != nil {
|
||||
log.Errorf("Opening storage failed: %s", err)
|
||||
return 1
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/fabxc/tsdb"
|
||||
tsdbLabels "github.com/fabxc/tsdb/labels"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/prometheus/pkg/labels"
|
||||
"github.com/prometheus/prometheus/storage"
|
||||
)
|
||||
|
@ -36,8 +37,8 @@ type Options struct {
|
|||
}
|
||||
|
||||
// Open returns a new storage backed by a tsdb database.
|
||||
func Open(path string, opts *Options) (storage.Storage, error) {
|
||||
db, err := tsdb.OpenPartitioned(path, 1, nil, &tsdb.Options{
|
||||
func Open(path string, r prometheus.Registerer, opts *Options) (storage.Storage, error) {
|
||||
db, err := tsdb.OpenPartitioned(path, 1, nil, r, &tsdb.Options{
|
||||
WALFlushInterval: 10 * time.Second,
|
||||
MinBlockDuration: uint64(opts.MinBlockDuration.Seconds() * 1000),
|
||||
MaxBlockDuration: uint64(opts.MaxBlockDuration.Seconds() * 1000),
|
||||
|
|
|
@ -20,7 +20,7 @@ func NewStorage(t T) storage.Storage {
|
|||
|
||||
log.With("dir", dir).Debugln("opening test storage")
|
||||
|
||||
db, err := tsdb.Open(dir, &tsdb.Options{
|
||||
db, err := tsdb.Open(dir, nil, &tsdb.Options{
|
||||
MinBlockDuration: 2 * time.Hour,
|
||||
MaxBlockDuration: 24 * time.Hour,
|
||||
AppendableBlocks: 10,
|
||||
|
|
Loading…
Reference in a new issue