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 ce25efc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 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
6 changes: 3 additions & 3 deletions cmd/tsdb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func main() {
}
wb.run()
case listCmd.FullCommand():
db, err := tsdb.NewDBReadOnly(*listPath, nil, nil)
db, err := tsdb.NewDBReadOnly(*listPath, nil)
if err != nil {
exitWithError(err)
}
Expand All @@ -81,7 +81,7 @@ func main() {
}
printBlocks(blocks, listCmdHumanReadable)
case analyzeCmd.FullCommand():
db, err := tsdb.NewDBReadOnly(*analyzePath, nil, nil)
db, err := tsdb.NewDBReadOnly(*analyzePath, nil)

if err != nil {
exitWithError(err)
Expand All @@ -106,7 +106,7 @@ func main() {
}
analyzeBlock(block, *analyzeLimit)
case dumpCmd.FullCommand():
db, err := tsdb.NewDBReadOnly(*dumpPath, nil, nil)
db, err := tsdb.NewDBReadOnly(*dumpPath, nil)

if err != nil {
exitWithError(err)
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 ce25efc

Please sign in to comment.