mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* o7 compactor Signed-off-by: Joe Elliott <[email protected]> * wip: o7 v2 Signed-off-by: Joe Elliott <[email protected]> * test cleanup Signed-off-by: Joe Elliott <[email protected]> * remove compactor from jsonnet Signed-off-by: Joe Elliott <[email protected]> * changelog Signed-off-by: Joe Elliott <[email protected]> * gen manifest Signed-off-by: Joe Elliott <[email protected]> * config cleanup Signed-off-by: Joe Elliott <[email protected]> * docs Signed-off-by: Joe Elliott <[email protected]> * jsonnet Signed-off-by: Joe Elliott <[email protected]> * remove encoding Signed-off-by: Joe Elliott <[email protected]> * remove data encoding Signed-off-by: Joe Elliott <[email protected]> * lint and cleanup Signed-off-by: Joe Elliott <[email protected]> * unflake TestWorker\? Signed-off-by: Joe Elliott <[email protected]> --------- Signed-off-by: Joe Elliott <[email protected]>
68 lines
1.2 KiB
Go
68 lines
1.2 KiB
Go
package storage
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/go-kit/log"
|
|
"github.com/grafana/dskit/services"
|
|
|
|
"github.com/grafana/tempo/pkg/cache"
|
|
"github.com/grafana/tempo/pkg/usagestats"
|
|
"github.com/grafana/tempo/tempodb"
|
|
)
|
|
|
|
var (
|
|
statCache = usagestats.NewString("storage_cache")
|
|
statBackend = usagestats.NewString("storage_backend")
|
|
)
|
|
|
|
// Store wraps the tempodb storage layer
|
|
type Store interface {
|
|
services.Service
|
|
|
|
tempodb.Reader
|
|
tempodb.Writer
|
|
tempodb.Compactor
|
|
}
|
|
|
|
type store struct {
|
|
services.Service
|
|
|
|
cfg Config
|
|
|
|
tempodb.Reader
|
|
tempodb.Writer
|
|
tempodb.Compactor
|
|
}
|
|
|
|
// NewStore creates a new Tempo Store using configuration supplied.
|
|
func NewStore(cfg Config, cacheProvider cache.Provider, logger log.Logger) (Store, error) {
|
|
statCache.Set(cfg.Trace.Cache)
|
|
statBackend.Set(cfg.Trace.Backend)
|
|
|
|
r, w, c, err := tempodb.New(&cfg.Trace, cacheProvider, logger)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
s := &store{
|
|
cfg: cfg,
|
|
Reader: r,
|
|
Writer: w,
|
|
Compactor: c,
|
|
}
|
|
|
|
s.Service = services.NewIdleService(s.starting, s.stopping)
|
|
return s, nil
|
|
}
|
|
|
|
func (s *store) starting(_ context.Context) error {
|
|
return nil
|
|
}
|
|
|
|
func (s *store) stopping(_ error) error {
|
|
s.Reader.Shutdown()
|
|
|
|
return nil
|
|
}
|