Files
Christian HaudumandGitHub 4bbb89047b Upgrade Cortex to v1.10.1-0.20211104100946-3f329a21cad4 (#1100)
Signed-off-by: Christian Haudum <[email protected]>
Co-authored-by:  Susana Ferreira <[email protected]>

Fix duplicate metrics registration

Signed-off-by: Christian Haudum <[email protected]>

Add debug logs to hedge request test

Signed-off-by: Christian Haudum <[email protected]>

Fix e2e test metric names

Remove prometheus/common replace in go.mod

Signed-off-by: Christian Haudum <[email protected]>
2021-11-05 13:17:17 -04:00

32 lines
860 B
Go

package modules
import (
"github.com/go-kit/log"
"github.com/grafana/dskit/services"
)
// This function wraps module service, and adds waiting for dependencies to start before starting,
// and dependant modules to stop before stopping this module service.
func newModuleServiceWrapper(serviceMap map[string]services.Service, mod string, logger log.Logger, modServ services.Service, startDeps []string, stopDeps []string) services.Service {
getDeps := func(deps []string) map[string]services.Service {
r := map[string]services.Service{}
for _, m := range deps {
s := serviceMap[m]
if s != nil {
r[m] = s
}
}
return r
}
return NewModuleService(mod, logger, modServ,
func(_ string) map[string]services.Service {
return getDeps(startDeps)
},
func(_ string) map[string]services.Service {
return getDeps(stopDeps)
},
)
}