Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose ring and memberlist handlers through internal server listener #7436

Merged
merged 1 commit into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -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.
Expand Down
32 changes: 31 additions & 1 deletion pkg/loki/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,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
}

Expand Down Expand Up @@ -342,6 +346,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
Expand Down Expand Up @@ -928,8 +936,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
Expand Down Expand Up @@ -990,6 +1002,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
}

Expand Down Expand Up @@ -1021,6 +1037,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))
Expand Down Expand Up @@ -1079,6 +1099,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
}

Expand All @@ -1094,6 +1119,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
}
Expand Down