(w http.ResponseWriter, r *http.Request)
| 50 | } |
| 51 | |
| 52 | func (t *Cortex) servicesHandler(w http.ResponseWriter, r *http.Request) { |
| 53 | svcs := make([]renderService, 0) |
| 54 | for mod, s := range t.ServiceMap { |
| 55 | svcs = append(svcs, renderService{ |
| 56 | Name: mod, |
| 57 | Status: s.State().String(), |
| 58 | }) |
| 59 | } |
| 60 | sort.Slice(svcs, func(i, j int) bool { |
| 61 | return svcs[i].Name < svcs[j].Name |
| 62 | }) |
| 63 | |
| 64 | // TODO: this could be extended to also print sub-services, if given service has any |
| 65 | util.RenderHTTPResponse(w, struct { |
| 66 | Now time.Time `json:"now"` |
| 67 | Services []renderService `json:"services"` |
| 68 | }{ |
| 69 | Now: time.Now(), |
| 70 | Services: svcs, |
| 71 | }, tmpl, r) |
| 72 | } |
nothing calls this directly
no test coverage detected