Skip to content

Commit

Permalink
Reference 'monolithic mode' instead of 'single binary' in logs (#1847)
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Co-authored-by: Ursula Kallio <ursula.kallio@grafana.com>

Co-authored-by: Ursula Kallio <ursula.kallio@grafana.com>
  • Loading branch information
pracucci and osg-grafana authored May 16, 2022
1 parent 2076e62 commit 5f62039
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
3 changes: 1 addition & 2 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ func (a *API) newRoute(path string, handler http.Handler, isPrefix, auth, gzip b
return route
}

// RegisterAlertmanager registers endpoints associated with the alertmanager. It will only
// serve endpoints using the legacy http-prefix if it is not run as a single binary.
// RegisterAlertmanager registers endpoints that are associated with the alertmanager.
func (a *API) RegisterAlertmanager(am *alertmanager.MultitenantAlertmanager, apiEnabled bool, buildInfoHandler http.Handler) {
alertmanagerpb.RegisterAlertmanagerServer(a.server.GRPC, am)

Expand Down
2 changes: 1 addition & 1 deletion pkg/api/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func NewQuerierHandler(
router := mux.NewRouter()

// Use a separate metric for the querier in order to differentiate requests from the query-frontend when
// running Mimir as a single binary.
// running Mimir in monolithic mode.
instrumentMiddleware := middleware.Instrument{
RouteMatcher: router,
Duration: querierRequestDuration,
Expand Down
2 changes: 1 addition & 1 deletion pkg/frontend/querymiddleware/results_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func errUnsupportedResultsCacheBackend(unsupportedBackend string) error {
// newResultsCache creates a new results cache based on the input configuration.
func newResultsCache(cfg ResultsCacheConfig, logger log.Logger, reg prometheus.Registerer) (cache.Cache, error) {
// Add the "component" label similarly to other components, so that metrics don't clash and have the same labels set
// when running in single binary mode.
// when running in monolithic mode.
reg = extprom.WrapRegistererWith(prometheus.Labels{"component": "query-frontend"}, reg)

client, err := cache.CreateClient("frontend-cache", cfg.BackendConfig, logger, reg)
Expand Down
11 changes: 4 additions & 7 deletions pkg/mimir/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,11 @@ func (t *Mimir) initQuerier() (serv services.Service, err error) {
// and internal using the default instrumentation when running as a standalone service.
internalQuerierRouter = t.Server.HTTPServer.Handler
} else {
// Single binary mode requires a query frontend endpoint for the worker. If no frontend and scheduler endpoint
// Monolithic mode requires a query-frontend endpoint for the worker. If no frontend and scheduler endpoint
// is configured, Mimir will default to using frontend on localhost on it's own GRPC listening port.
if t.Cfg.Worker.FrontendAddress == "" && t.Cfg.Worker.SchedulerAddress == "" {
address := fmt.Sprintf("127.0.0.1:%d", t.Cfg.Server.GRPCListenPort)
level.Warn(util_log.Logger).Log("msg", "Worker address is empty in single binary mode. Attempting automatic worker configuration. If queries are unresponsive consider configuring the worker explicitly.", "address", address)
level.Info(util_log.Logger).Log("msg", "The querier worker has not been configured with either the query-frontend or query-scheduler address. Because Mimir is running in monolithic mode, it's attempting an automatic worker configuration. If queries are unresponsive, consider explicitly configuring the query-frontend or query-scheduler address for querier worker.", "address", address)
t.Cfg.Worker.FrontendAddress = address
}

Expand Down Expand Up @@ -548,12 +548,9 @@ func (t *Mimir) initQueryFrontend() (serv services.Service, err error) {
}

func (t *Mimir) initRulerStorage() (serv services.Service, err error) {
// if the ruler is not configured and we're in single binary then let's just log an error and continue.
// unfortunately there is no way to generate a "default" config and compare default against actual
// to determine if it's unconfigured. the following check, however, correctly tests this.
// Single binary integration tests will break if this ever drifts
// If the ruler is not configured and Mimir is running in monolithic mode, then we just skip starting the ruler.
if t.Cfg.isModuleEnabled(All) && t.Cfg.RulerStorage.IsDefaults() {
level.Info(util_log.Logger).Log("msg", "Ruler storage is not configured in single binary mode and will not be started.")
level.Info(util_log.Logger).Log("msg", "The ruler is not being started because you need to configure the ruler storage.")
return
}

Expand Down

0 comments on commit 5f62039

Please sign in to comment.