MCPcopy Index your code
hub / github.com/cortexproject/cortex / servicesHandler

Method servicesHandler

pkg/cortex/status.go:52–72  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

50}
51
52func (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}

Callers

nothing calls this directly

Calls 3

RenderHTTPResponseFunction · 0.92
StringMethod · 0.65
StateMethod · 0.65

Tested by

no test coverage detected