Skip to content

Commit

Permalink
mimir: register block-builder target
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Varankin <[email protected]>
  • Loading branch information
narqo committed Sep 25, 2024
1 parent 1d6295e commit f61c7ea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/mimir/mimir.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import (
alertbucketclient "github.com/grafana/mimir/pkg/alertmanager/alertstore/bucketclient"
alertstorelocal "github.com/grafana/mimir/pkg/alertmanager/alertstore/local"
"github.com/grafana/mimir/pkg/api"
"github.com/grafana/mimir/pkg/blockbuilder"
"github.com/grafana/mimir/pkg/compactor"
"github.com/grafana/mimir/pkg/continuoustest"
"github.com/grafana/mimir/pkg/distributor"
Expand Down Expand Up @@ -123,6 +124,7 @@ type Config struct {
Worker querier_worker.Config `yaml:"frontend_worker"`
Frontend frontend.CombinedFrontendConfig `yaml:"frontend"`
IngestStorage ingest.Config `yaml:"ingest_storage"`
BlockBuilder blockbuilder.Config `yaml:"block_builder" doc:"hidden"`
BlocksStorage tsdb.BlocksStorageConfig `yaml:"blocks_storage"`
Compactor compactor.Config `yaml:"compactor"`
StoreGateway storegateway.Config `yaml:"store_gateway"`
Expand Down Expand Up @@ -181,6 +183,7 @@ func (c *Config) RegisterFlags(f *flag.FlagSet, logger log.Logger) {
c.Worker.RegisterFlags(f)
c.Frontend.RegisterFlags(f, logger)
c.IngestStorage.RegisterFlags(f)
c.BlockBuilder.RegisterFlags(f, logger)
c.BlocksStorage.RegisterFlags(f)
c.Compactor.RegisterFlags(f, logger)
c.StoreGateway.RegisterFlags(f, logger)
Expand Down Expand Up @@ -730,6 +733,7 @@ type Mimir struct {
ActivityTracker *activitytracker.ActivityTracker
Vault *vault.Vault
UsageStatsReporter *usagestats.Reporter
BlockBuilder *blockbuilder.BlockBuilder
ContinuousTestManager *continuoustest.Manager
BuildInfoHandler http.Handler
}
Expand Down
14 changes: 14 additions & 0 deletions pkg/mimir/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/grafana/mimir/pkg/alertmanager/alertstore"
"github.com/grafana/mimir/pkg/alertmanager/alertstore/bucketclient"
"github.com/grafana/mimir/pkg/api"
"github.com/grafana/mimir/pkg/blockbuilder"
"github.com/grafana/mimir/pkg/compactor"
"github.com/grafana/mimir/pkg/continuoustest"
"github.com/grafana/mimir/pkg/distributor"
Expand Down Expand Up @@ -100,6 +101,7 @@ const (
Vault string = "vault"
TenantFederation string = "tenant-federation"
UsageStats string = "usage-stats"
BlockBuilder string = "block-builder"
ContinuousTest string = "continuous-test"
All string = "all"

Expand Down Expand Up @@ -1083,6 +1085,16 @@ func (t *Mimir) initUsageStats() (services.Service, error) {
return t.UsageStatsReporter, nil
}

func (t *Mimir) initBlockBuilder() (_ services.Service, err error) {
t.Cfg.BlockBuilder.Kafka = t.Cfg.IngestStorage.KafkaConfig
t.Cfg.BlockBuilder.BlocksStorage = t.Cfg.BlocksStorage
t.BlockBuilder, err = blockbuilder.New(t.Cfg.BlockBuilder, util_log.Logger, t.Registerer, t.Overrides)
if err != nil {
return nil, errors.Wrap(err, "block-builder init")
}
return t.BlockBuilder, nil
}

func (t *Mimir) initContinuousTest() (services.Service, error) {
client, err := continuoustest.NewClient(t.Cfg.ContinuousTest.Client, util_log.Logger)
if err != nil {
Expand Down Expand Up @@ -1133,6 +1145,7 @@ func (t *Mimir) setupModuleManager() error {
mm.RegisterModule(QueryScheduler, t.initQueryScheduler)
mm.RegisterModule(TenantFederation, t.initTenantFederation, modules.UserInvisibleModule)
mm.RegisterModule(UsageStats, t.initUsageStats, modules.UserInvisibleModule)
mm.RegisterModule(BlockBuilder, t.initBlockBuilder)
mm.RegisterModule(ContinuousTest, t.initContinuousTest)
mm.RegisterModule(Vault, t.initVault, modules.UserInvisibleModule)
mm.RegisterModule(Write, nil)
Expand Down Expand Up @@ -1168,6 +1181,7 @@ func (t *Mimir) setupModuleManager() error {
Compactor: {API, MemberlistKV, Overrides, Vault},
StoreGateway: {API, Overrides, MemberlistKV, Vault},
TenantFederation: {Queryable},
BlockBuilder: {API, Overrides},
ContinuousTest: {API},
Write: {Distributor, Ingester},
Read: {QueryFrontend, Querier},
Expand Down

0 comments on commit f61c7ea

Please sign in to comment.