Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## master / unreleased

* [CHANGE] Distributor API endpoints are no longer served unless target is set to `distributor` or `all`. #3112
* [CHANGE] Increase the default Cassandra client replication factor to 3. #3007
* [CHANGE] Experimental blocks storage: removed the support to transfer blocks between ingesters on shutdown. When running the Cortex blocks storage, ingesters are expected to run with a persistent disk. The following metrics have been removed: #2996
* `cortex_ingester_sent_files`
Expand Down
2 changes: 1 addition & 1 deletion pkg/cortex/cortex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@ func TestCortex(t *testing.T) {
require.NotNil(t, serviceMap[Server])
require.NotNil(t, serviceMap[Ingester])
require.NotNil(t, serviceMap[Ring])
require.NotNil(t, serviceMap[Distributor])
require.NotNil(t, serviceMap[DistributorService])
}
52 changes: 31 additions & 21 deletions pkg/cortex/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ const (
Overrides string = "overrides"
Server string = "server"
Distributor string = "distributor"
DistributorService string = "distributor-service"
DistributorAPI string = "distributor-api"
Ingester string = "ingester"
Flusher string = "flusher"
Querier string = "querier"
Expand Down Expand Up @@ -150,7 +152,7 @@ func (t *Cortex) initOverrides() (serv services.Service, err error) {
return nil, err
}

func (t *Cortex) initDistributor() (serv services.Service, err error) {
func (t *Cortex) initDistributorService() (serv services.Service, err error) {
t.Cfg.Distributor.DistributorRing.ListenPort = t.Cfg.Server.GRPCListenPort

// Check whether the distributor can join the distributors ring, which is
Expand All @@ -163,9 +165,13 @@ func (t *Cortex) initDistributor() (serv services.Service, err error) {
return
}

return t.Distributor, nil
}

func (t *Cortex) initDistributorAPI() (serv services.Service, err error) {
t.API.RegisterDistributor(t.Distributor, t.Cfg.Distributor)

return t.Distributor, nil
return nil, nil
}

func (t *Cortex) initQuerier() (serv services.Service, err error) {
Expand Down Expand Up @@ -630,7 +636,9 @@ func (t *Cortex) setupModuleManager() error {
mm.RegisterModule(MemberlistKV, t.initMemberlistKV, modules.UserInvisibleModule)
mm.RegisterModule(Ring, t.initRing, modules.UserInvisibleModule)
mm.RegisterModule(Overrides, t.initOverrides, modules.UserInvisibleModule)
mm.RegisterModule(Distributor, t.initDistributor)
mm.RegisterModule(Distributor, nil)
mm.RegisterModule(DistributorAPI, t.initDistributorAPI)
mm.RegisterModule(DistributorService, t.initDistributorService)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DistributorService should use modules.UserInvisibleModule option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

mm.RegisterModule(Store, t.initChunkStore, modules.UserInvisibleModule)
mm.RegisterModule(DeleteRequestsStore, t.initDeleteRequestsStore, modules.UserInvisibleModule)
mm.RegisterModule(Ingester, t.initIngester)
Expand All @@ -650,24 +658,26 @@ func (t *Cortex) setupModuleManager() error {

// Add dependencies
deps := map[string][]string{
API: {Server},
Ring: {API, RuntimeConfig, MemberlistKV},
Overrides: {RuntimeConfig},
Distributor: {Ring, API, Overrides},
Store: {Overrides, DeleteRequestsStore},
Ingester: {Overrides, Store, API, RuntimeConfig, MemberlistKV},
Flusher: {Store, API},
Querier: {Overrides, Distributor, Store, Ring, API, StoreQueryable, MemberlistKV},
StoreQueryable: {Overrides, Store},
QueryFrontend: {API, Overrides, DeleteRequestsStore},
TableManager: {API},
Ruler: {Overrides, Distributor, Store, StoreQueryable, RulerStorage},
Configs: {API},
AlertManager: {API},
Compactor: {API, MemberlistKV},
StoreGateway: {API, Overrides, MemberlistKV},
Purger: {Store, DeleteRequestsStore, API},
All: {QueryFrontend, Querier, Ingester, Distributor, TableManager, Purger, StoreGateway, Ruler},
API: {Server},
Ring: {API, RuntimeConfig, MemberlistKV},
Overrides: {RuntimeConfig},
Distributor: {DistributorService, DistributorAPI},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both Distributor and DistributorAPI?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the DistributorAPI can be removed and the route registration can be moved to the Distributor module

DistributorAPI: {DistributorService, API},
DistributorService: {Ring, Overrides},
Store: {Overrides, DeleteRequestsStore},
Ingester: {Overrides, Store, API, RuntimeConfig, MemberlistKV},
Flusher: {Store, API},
Querier: {Overrides, DistributorService, Store, Ring, API, StoreQueryable, MemberlistKV},
StoreQueryable: {Overrides, Store},
QueryFrontend: {API, Overrides, DeleteRequestsStore},
TableManager: {API},
Ruler: {Overrides, DistributorService, Store, StoreQueryable, RulerStorage},
Configs: {API},
AlertManager: {API},
Compactor: {API, MemberlistKV},
StoreGateway: {API, Overrides, MemberlistKV},
Purger: {Store, DeleteRequestsStore, API},
All: {QueryFrontend, Querier, Ingester, Distributor, TableManager, Purger, StoreGateway, Ruler},
}
for mod, targets := range deps {
if err := mm.AddDependency(mod, targets...); err != nil {
Expand Down