Fix internal server bootstrap for query frontend (#7328)

Adds a fix for setting up the internal server module
pull/7334/head
Periklis Tsirakidis 3 years ago committed by GitHub
parent 4103b32d0a
commit e9419747c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 8
      pkg/loki/loki.go
  3. 37
      pkg/loki/loki_test.go

@ -25,6 +25,7 @@
* [7270](https://github.com/grafana/loki/pull/7270) **wilfriedroset**: Add support for `username` to redis cache configuration.
##### Fixes
* [7238](https://github.com/grafana/loki/pull/7328) **periklis**: Fix internal server bootstrap for query frontend
* [7288](https://github.com/grafana/loki/pull/7288) **ssncferreira**: Fix query mapping in AST mapper `rangemapper` to support the new `VectorExpr` expression.
* [7040](https://github.com/grafana/loki/pull/7040) **bakunowski**: Remove duplicated `loki_boltdb_shipper` prefix from `tables_upload_operation_total` metric.
* [6937](https://github.com/grafana/loki/pull/6937) **ssncferreira**: Fix topk and bottomk expressions with parameter <= 0.

@ -66,7 +66,7 @@ type Config struct {
BallastBytes int `yaml:"ballast_bytes"`
// TODO(dannyk): Remove these config options before next release; they don't need to be configurable.
// These are only here to allow us to test the new functionality.
// These are only here to allow us to test the new functionality.
UseBufferedLogger bool `yaml:"use_buffered_logger"`
UseSyncLogger bool `yaml:"use_sync_logger"`
@ -570,7 +570,7 @@ func (t *Loki) setupModuleManager() error {
}
if t.Cfg.InternalServer.Enable {
depsToUpdate := []string{Distributor, Ingester, Querier, QueryFrontend, QueryScheduler, Ruler, TableManager, Compactor, IndexGateway}
depsToUpdate := []string{Distributor, Ingester, Querier, QueryFrontendTripperware, QueryScheduler, Ruler, TableManager, Compactor, IndexGateway}
for _, dep := range depsToUpdate {
var idx int
@ -581,8 +581,8 @@ func (t *Loki) setupModuleManager() error {
}
}
lhs := deps[dep][0:idx]
rhs := deps[dep][idx+1:]
lhs := deps[dep][0 : idx+1]
rhs := deps[dep][idx+2:]
deps[dep] = append(lhs, InternalServer)
deps[dep] = append(deps[dep], rhs...)

@ -99,24 +99,55 @@ func TestLoki_isModuleEnabled(t1 *testing.T) {
}
func TestLoki_AppendOptionalInternalServer(t *testing.T) {
tests := []string{Distributor, Ingester, Querier, QueryFrontend, QueryScheduler, Ruler, TableManager, Compactor, IndexGateway}
fake := &Loki{
Cfg: Config{
Target: flagext.StringSliceCSV{All},
Server: server.Config{
HTTPListenAddress: "3100",
},
},
}
err := fake.setupModuleManager()
assert.NoError(t, err)
var tests []string
for target, deps := range fake.deps {
switch target {
// Blacklist these targets for using the internal server
case IndexGatewayRing, MemberlistKV, OverridesExporter, Ring, Embededcache, Server:
continue
}
for _, dep := range deps {
if dep == Server {
tests = append(tests, target)
break
}
}
}
assert.NotEmpty(t, tests, tests)
for _, tt := range tests {
t.Run(tt, func(t *testing.T) {
l := &Loki{
Cfg: Config{
Target: flagext.StringSliceCSV{tt},
Server: server.Config{
HTTPListenAddress: "3100",
},
InternalServer: internalserver.Config{
Config: server.Config{
HTTPListenAddress: "3002",
HTTPListenAddress: "3101",
},
Enable: true,
},
},
}
err := l.setupModuleManager()
assert.NoError(t, err)
assert.Contains(t, l.deps[tt], InternalServer)
assert.Contains(t, l.deps[tt], Server)
})
}
}

Loading…
Cancel
Save