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

Return and log detailed services information on /ready #2055

Merged
merged 2 commits into from
Jun 8, 2022
Merged
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
11 changes: 7 additions & 4 deletions pkg/mimir/mimir.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,12 +530,15 @@ func (t *Mimir) readyHandler(sm *services.Manager) http.HandlerFunc {
msg := bytes.Buffer{}
msg.WriteString("Some services are not Running:\n")

byState := sm.ServicesByState()
for st, ls := range byState {
msg.WriteString(fmt.Sprintf("%v: %d\n", st, len(ls)))
for name, s := range t.ServiceMap {
if s.State() != services.Running {
msg.WriteString(fmt.Sprintf("%s: %s\n", name, s.State()))
}
}

http.Error(w, msg.String(), http.StatusServiceUnavailable)
strMsg := msg.String()
level.Debug(util_log.Logger).Log(strMsg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to debug-log this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My original thinking was that this should make it easier to see why components aren't ready - no need to port-forward to pods and curl endpoints - it will be in the logs.

Do you think that would be useful?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have logs for each starting/started module, which can be used to find out which modules aren't ready.

If we change this log line to only log non-ready modules, I think it would be more useful than logging ALL modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we change this log line to only log non-ready modules, I think it would be more useful than logging ALL modules.

agreed, pushed a change in d214659

http.Error(w, strMsg, http.StatusServiceUnavailable)
return
}

Expand Down