From 8edbe2b361cbb443606c8a51be5dc7c5c84b5f70 Mon Sep 17 00:00:00 2001 From: Mauro Stettler Date: Thu, 30 Sep 2021 17:31:35 +0000 Subject: [PATCH 1/3] add virtual targets --- pkg/loki/loki.go | 7 ++++++- pkg/loki/modules.go | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pkg/loki/loki.go b/pkg/loki/loki.go index 7ddff964a0873..1104c86b2e1fe 100644 --- a/pkg/loki/loki.go +++ b/pkg/loki/loki.go @@ -418,7 +418,12 @@ func (t *Loki) setupModuleManager() error { Compactor: {Server, Overrides}, IndexGateway: {Server}, IngesterQuerier: {Ring}, - All: {QueryFrontend, Querier, Ingester, Distributor, TableManager, Ruler}, + + // Virtual Targets + All: {QueryFrontend, Querier, Ingester, Distributor, TableManager, Ruler}, + Read: {QueryFrontend, QueryScheduler, Querier}, + Write: {Ingester, Distributor}, + Async: {Ruler, TableManager, Compactor}, } // Add IngesterQuerier as a dependency for store when target is either ingester or querier. diff --git a/pkg/loki/modules.go b/pkg/loki/modules.go index fd9a6fb712db6..75066003b78ad 100644 --- a/pkg/loki/modules.go +++ b/pkg/loki/modules.go @@ -78,7 +78,12 @@ const ( Compactor string = "compactor" IndexGateway string = "index-gateway" QueryScheduler string = "query-scheduler" - All string = "all" + + // Virtual Targets + All string = "all" + Read string = "read" + Write string = "write" + Async string = "async" ) func (t *Loki) initServer() (services.Service, error) { @@ -209,7 +214,7 @@ func (t *Loki) initQuerier() (services.Service, error) { QuerySchedulerEnabled: t.Cfg.isModuleEnabled(QueryScheduler), } - var queryHandlers = map[string]http.Handler{ + queryHandlers := map[string]http.Handler{ "/loki/api/v1/query_range": http.HandlerFunc(t.Querier.RangeQueryHandler), "/loki/api/v1/query": http.HandlerFunc(t.Querier.InstantQueryHandler), "/loki/api/v1/label": http.HandlerFunc(t.Querier.LabelHandler), From 28330281931fbac005b6a37becb096fb6409e91e Mon Sep 17 00:00:00 2001 From: Mauro Stettler Date: Fri, 1 Oct 2021 15:48:59 +0000 Subject: [PATCH 2/3] remove table manager in async target --- pkg/loki/loki.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/loki/loki.go b/pkg/loki/loki.go index 1104c86b2e1fe..7daf07d648679 100644 --- a/pkg/loki/loki.go +++ b/pkg/loki/loki.go @@ -423,7 +423,7 @@ func (t *Loki) setupModuleManager() error { All: {QueryFrontend, Querier, Ingester, Distributor, TableManager, Ruler}, Read: {QueryFrontend, QueryScheduler, Querier}, Write: {Ingester, Distributor}, - Async: {Ruler, TableManager, Compactor}, + Async: {Ruler, Compactor}, } // Add IngesterQuerier as a dependency for store when target is either ingester or querier. From cf74af3eb2e7554d023d74520d7a842d23b43c7b Mon Sep 17 00:00:00 2001 From: Mauro Stettler Date: Wed, 6 Oct 2021 17:34:57 +0000 Subject: [PATCH 3/3] update virtual targets according to our latest discussion --- pkg/loki/loki.go | 3 +-- pkg/loki/modules.go | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/loki/loki.go b/pkg/loki/loki.go index 7daf07d648679..0757edfc0f9d7 100644 --- a/pkg/loki/loki.go +++ b/pkg/loki/loki.go @@ -421,9 +421,8 @@ func (t *Loki) setupModuleManager() error { // Virtual Targets All: {QueryFrontend, Querier, Ingester, Distributor, TableManager, Ruler}, - Read: {QueryFrontend, QueryScheduler, Querier}, + Read: {QueryFrontend, QueryScheduler, Querier, Ruler}, Write: {Ingester, Distributor}, - Async: {Ruler, Compactor}, } // Add IngesterQuerier as a dependency for store when target is either ingester or querier. diff --git a/pkg/loki/modules.go b/pkg/loki/modules.go index 75066003b78ad..5761de49a4c7c 100644 --- a/pkg/loki/modules.go +++ b/pkg/loki/modules.go @@ -83,7 +83,6 @@ const ( All string = "all" Read string = "read" Write string = "write" - Async string = "async" ) func (t *Loki) initServer() (services.Service, error) {