Skip to content

Commit

Permalink
Merge pull request #27 from arajkumar/close-frostdb
Browse files Browse the repository at this point in the history
Persistent frostdb with WAL and local bucket store
  • Loading branch information
thorfour authored Aug 23, 2022
2 parents 62d5aef + 94b8b71 commit f9cfeaf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions frostdb/frostdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb/chunkenc"
"github.com/segmentio/parquet-go"
"github.com/thanos-io/objstore/providers/filesystem"
)

type FrostDB struct {
Expand All @@ -43,12 +44,14 @@ type FrostQuerier struct {

// Open a new frostDB
func Open(dir string, reg prometheus.Registerer, logger log.Logger) (*FrostDB, error) {
bucket, err := filesystem.NewBucket(dir)
ctx := context.Background()
store, err := frost.New(
logger,
reg,
frost.WithWAL(),
frost.WithStoragePath(dir),
frost.WithBucketStorage(bucket),
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -158,7 +161,9 @@ func (f *FrostQuerier) LabelNames(matchers ...*labels.Matcher) ([]string, storag
return names, nil, nil
}

func (f *FrostQuerier) Close() error { return nil }
func (f *FrostQuerier) Close() error {
return nil
}

func (f *FrostQuerier) Select(sortSeries bool, hints *storage.SelectHints, matchers ...*labels.Matcher) storage.SeriesSet {
engine := query.NewEngine(
Expand Down Expand Up @@ -201,7 +206,7 @@ func (f *FrostDB) StartTime() (int64, error) {
}

func (f *FrostDB) Close() error {
return nil
return f.store.Close()
}

func (f *FrostDB) Appender(ctx context.Context) storage.Appender {
Expand Down
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ require (
github.com/oklog/run v1.1.0
github.com/oklog/ulid v1.3.1
github.com/pkg/errors v0.9.1
github.com/polarsignals/frostdb v0.0.0-20220811073159-2f68e10c0065
github.com/polarsignals/frostdb v0.0.0-20220822212344-f4b1d7b8c4db
github.com/prometheus/alertmanager v0.24.0
github.com/prometheus/client_golang v1.12.2
github.com/prometheus/client_model v0.2.0
Expand All @@ -51,6 +51,7 @@ require (
github.com/segmentio/parquet-go v0.0.0-20220802221544-d84ed320251d
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749
github.com/stretchr/testify v1.7.2
github.com/thanos-io/objstore v0.0.0-20220715165016-ce338803bc1e
github.com/vultr/govultr/v2 v2.17.1
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0
go.opentelemetry.io/otel v1.7.0
Expand Down Expand Up @@ -179,7 +180,6 @@ require (
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/thanos-io/objstore v0.0.0-20220715165016-ce338803bc1e // indirect
github.com/tidwall/gjson v1.10.2 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
Expand Down Expand Up @@ -219,3 +219,5 @@ exclude (
github.com/grpc-ecosystem/grpc-gateway v1.14.7
google.golang.org/api v0.30.0
)

replace github.com/polarsignals/frostdb => ../frostdb
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -824,8 +824,6 @@ github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6J
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/polarsignals/frostdb v0.0.0-20220811073159-2f68e10c0065 h1:Q9cplS14JxWdeLXb//d9WBLSSkWQJ37aND9mh8adtcs=
github.com/polarsignals/frostdb v0.0.0-20220811073159-2f68e10c0065/go.mod h1:pAYbFxj4Tkqo1uqmv+MO7qvDd+SOZnFxzsUoLqAbLLo=
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
Expand Down

0 comments on commit f9cfeaf

Please sign in to comment.