Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Commit

Permalink
remove metrics
Browse files Browse the repository at this point in the history
Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
  • Loading branch information
Krasi Georgiev committed Apr 25, 2019
1 parent a16cd17 commit 6fded52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## master / unreleased
- [FEATURE] New `OpenReadOnly` API to allow opening a database in read only mode.
- [FEATURE] Added `DBReadOnly` to allow opening a database in read only mode.

## 0.7.0
- [CHANGE] tsdb now requires golang 1.12 or higher.
Expand Down
15 changes: 6 additions & 9 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,12 @@ func newDBMetrics(db *DB, r prometheus.Registerer) *dbMetrics {

// DBReadOnly provides APIs for read only operations on a database.
type DBReadOnly struct {
logger log.Logger
dir string
registerer prometheus.Registerer
logger log.Logger
dir string
}

// NewDBReadOnly returns a new DB in the given directory for read only operations.
func NewDBReadOnly(dir string, l log.Logger, r prometheus.Registerer) (*DBReadOnly, error) {
func NewDBReadOnly(dir string, l log.Logger) (*DBReadOnly, error) {
if _, err := os.Stat(dir); err != nil {
return nil, err
}
Expand All @@ -263,9 +262,8 @@ func NewDBReadOnly(dir string, l log.Logger, r prometheus.Registerer) (*DBReadOn
}

db := &DBReadOnly{
logger: l,
dir: dir,
registerer: r,
logger: l,
dir: dir,
}

return db, nil
Expand All @@ -274,7 +272,7 @@ func NewDBReadOnly(dir string, l log.Logger, r prometheus.Registerer) (*DBReadOn
// Querier loads the wal and returns a new querier over the data partition for the given time range.
// A goroutine must not handle more than one open Querier.
func (dbRead *DBReadOnly) Querier(mint, maxt int64) (Querier, error) {
head, err := NewHead(dbRead.registerer, dbRead.logger, nil, 1)
head, err := NewHead(nil, dbRead.logger, nil, 1)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -311,7 +309,6 @@ func (dbRead *DBReadOnly) Blocks() ([]*Block, error) {
dir: dbRead.dir,
logger: dbRead.logger,
}
db.metrics = newDBMetrics(db, dbRead.registerer)

loadable, corrupted, err := db.openBlocks()
if err != nil {
Expand Down

0 comments on commit 6fded52

Please sign in to comment.