diff --git a/CHANGELOG.md b/CHANGELOG.md index 92c6e91b50a0..2a4bd69c6df3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ #### Loki ##### Enhancements +* [7436](https://github.com/grafana/loki/pull/7436) **periklis**: Expose ring and memberlist handlers through internal server listener * [7346](https://github.com/grafana/loki/pull/7346) **mostafa**: Clarify how and where to download the Loki config file from * [7227](https://github.com/grafana/loki/pull/7227) **Red-GV**: Add ability to configure tls minimum version and cipher suites * [7179](https://github.com/grafana/loki/pull/7179) **vlad-diachenko**: Add ability to use Azure Service Principals credentials to authenticate to Azure Blob Storage. diff --git a/pkg/loki/modules.go b/pkg/loki/modules.go index 89fc1e0f05e3..f2baa8c453c9 100644 --- a/pkg/loki/modules.go +++ b/pkg/loki/modules.go @@ -202,6 +202,10 @@ func (t *Loki) initRing() (_ services.Service, err error) { return } t.Server.HTTP.Path("/ring").Methods("GET", "POST").Handler(t.ring) + + if t.Cfg.InternalServer.Enable { + t.InternalServer.HTTP.Path("/ring").Methods("GET").Handler(t.ring) + } return t.ring, nil } @@ -344,6 +348,10 @@ func (t *Loki) initDistributor() (services.Service, error) { t.Server.HTTP.Path("/distributor/ring").Methods("GET", "POST").Handler(t.distributor) + if t.Cfg.InternalServer.Enable { + t.InternalServer.HTTP.Path("/distributor/ring").Methods("GET").Handler(t.distributor) + } + t.Server.HTTP.Path("/api/prom/push").Methods("POST").Handler(pushHandler) t.Server.HTTP.Path("/loki/api/v1/push").Methods("POST").Handler(pushHandler) return t.distributor, nil @@ -930,8 +938,12 @@ func (t *Loki) initRuler() (_ services.Service, err error) { // Expose HTTP endpoints. if t.Cfg.Ruler.EnableAPI { - t.Server.HTTP.Path("/ruler/ring").Methods("GET", "POST").Handler(t.ruler) + + if t.Cfg.InternalServer.Enable { + t.InternalServer.HTTP.Path("/ruler/ring").Methods("GET").Handler(t.ruler) + } + base_ruler.RegisterRulerServer(t.Server.GRPC, t.ruler) // Prometheus Rule API Routes @@ -992,6 +1004,10 @@ func (t *Loki) initMemberlistKV() (services.Service, error) { t.Server.HTTP.Handle("/memberlist", t.MemberlistKV) + if t.Cfg.InternalServer.Enable { + t.InternalServer.HTTP.Path("/memberlist").Methods("GET").Handler(t.MemberlistKV) + } + return t.MemberlistKV, nil } @@ -1023,6 +1039,10 @@ func (t *Loki) initCompactor() (services.Service, error) { t.compactor.RegisterIndexCompactor(config.TSDBType, tsdb.NewIndexCompactor()) t.Server.HTTP.Path("/compactor/ring").Methods("GET", "POST").Handler(t.compactor) + if t.Cfg.InternalServer.Enable { + t.InternalServer.HTTP.Path("/compactor/ring").Methods("GET").Handler(t.compactor) + } + if t.Cfg.CompactorConfig.RetentionEnabled { t.Server.HTTP.Path("/loki/api/v1/delete").Methods("PUT", "POST").Handler(t.addCompactorMiddleware(t.compactor.DeleteRequestsHandler.AddDeleteRequestHandler)) t.Server.HTTP.Path("/loki/api/v1/delete").Methods("GET").Handler(t.addCompactorMiddleware(t.compactor.DeleteRequestsHandler.GetAllDeleteRequestsHandler)) @@ -1081,6 +1101,11 @@ func (t *Loki) initIndexGatewayRing() (_ services.Service, err error) { t.indexGatewayRingManager = rm t.Server.HTTP.Path("/indexgateway/ring").Methods("GET", "POST").Handler(t.indexGatewayRingManager) + + if t.Cfg.InternalServer.Enable { + t.InternalServer.HTTP.Path("/indexgateway/ring").Methods("GET").Handler(t.indexGatewayRingManager) + } + return t.indexGatewayRingManager, nil } @@ -1096,6 +1121,11 @@ func (t *Loki) initQueryScheduler() (services.Service, error) { schedulerpb.RegisterSchedulerForFrontendServer(t.Server.GRPC, s) schedulerpb.RegisterSchedulerForQuerierServer(t.Server.GRPC, s) t.Server.HTTP.Path("/scheduler/ring").Methods("GET", "POST").Handler(s) + + if t.Cfg.InternalServer.Enable { + t.InternalServer.HTTP.Path("/scheduler/ring").Methods("GET").Handler(s) + } + t.queryScheduler = s return s, nil }