Skip to content

Commit f9cfeaf

Browse files
authored
Merge pull request #27 from arajkumar/close-frostdb
Persistent frostdb with WAL and local bucket store
2 parents 62d5aef + 94b8b71 commit f9cfeaf

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

frostdb/frostdb.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/prometheus/prometheus/storage"
2323
"github.com/prometheus/prometheus/tsdb/chunkenc"
2424
"github.com/segmentio/parquet-go"
25+
"github.com/thanos-io/objstore/providers/filesystem"
2526
)
2627

2728
type FrostDB struct {
@@ -43,12 +44,14 @@ type FrostQuerier struct {
4344

4445
// Open a new frostDB
4546
func Open(dir string, reg prometheus.Registerer, logger log.Logger) (*FrostDB, error) {
47+
bucket, err := filesystem.NewBucket(dir)
4648
ctx := context.Background()
4749
store, err := frost.New(
4850
logger,
4951
reg,
5052
frost.WithWAL(),
5153
frost.WithStoragePath(dir),
54+
frost.WithBucketStorage(bucket),
5255
)
5356
if err != nil {
5457
return nil, err
@@ -158,7 +161,9 @@ func (f *FrostQuerier) LabelNames(matchers ...*labels.Matcher) ([]string, storag
158161
return names, nil, nil
159162
}
160163

161-
func (f *FrostQuerier) Close() error { return nil }
164+
func (f *FrostQuerier) Close() error {
165+
return nil
166+
}
162167

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

203208
func (f *FrostDB) Close() error {
204-
return nil
209+
return f.store.Close()
205210
}
206211

207212
func (f *FrostDB) Appender(ctx context.Context) storage.Appender {

go.mod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ require (
3939
github.com/oklog/run v1.1.0
4040
github.com/oklog/ulid v1.3.1
4141
github.com/pkg/errors v0.9.1
42-
github.com/polarsignals/frostdb v0.0.0-20220811073159-2f68e10c0065
42+
github.com/polarsignals/frostdb v0.0.0-20220822212344-f4b1d7b8c4db
4343
github.com/prometheus/alertmanager v0.24.0
4444
github.com/prometheus/client_golang v1.12.2
4545
github.com/prometheus/client_model v0.2.0
@@ -51,6 +51,7 @@ require (
5151
github.com/segmentio/parquet-go v0.0.0-20220802221544-d84ed320251d
5252
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749
5353
github.com/stretchr/testify v1.7.2
54+
github.com/thanos-io/objstore v0.0.0-20220715165016-ce338803bc1e
5455
github.com/vultr/govultr/v2 v2.17.1
5556
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0
5657
go.opentelemetry.io/otel v1.7.0
@@ -179,7 +180,6 @@ require (
179180
github.com/sirupsen/logrus v1.8.1 // indirect
180181
github.com/spf13/pflag v1.0.5 // indirect
181182
github.com/stretchr/objx v0.2.0 // indirect
182-
github.com/thanos-io/objstore v0.0.0-20220715165016-ce338803bc1e // indirect
183183
github.com/tidwall/gjson v1.10.2 // indirect
184184
github.com/tidwall/match v1.1.1 // indirect
185185
github.com/tidwall/pretty v1.2.0 // indirect
@@ -219,3 +219,5 @@ exclude (
219219
github.com/grpc-ecosystem/grpc-gateway v1.14.7
220220
google.golang.org/api v0.30.0
221221
)
222+
223+
replace github.com/polarsignals/frostdb => ../frostdb

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,8 +824,6 @@ github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6J
824824
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
825825
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
826826
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
827-
github.com/polarsignals/frostdb v0.0.0-20220811073159-2f68e10c0065 h1:Q9cplS14JxWdeLXb//d9WBLSSkWQJ37aND9mh8adtcs=
828-
github.com/polarsignals/frostdb v0.0.0-20220811073159-2f68e10c0065/go.mod h1:pAYbFxj4Tkqo1uqmv+MO7qvDd+SOZnFxzsUoLqAbLLo=
829827
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
830828
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
831829
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=

0 commit comments

Comments
 (0)