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

Method ServeHTTP

pkg/api/handlers.go:365–387  ·  view source on GitHub ↗
(writer http.ResponseWriter, _ *http.Request)

Source from the content-addressed store, hash-verified

363}
364
365func (h *buildInfoHandler) ServeHTTP(writer http.ResponseWriter, _ *http.Request) {
366 infoResponse := buildInfoResponse{
367 Status: "success",
368 Data: &v1.PrometheusVersion{
369 Version: version.Version,
370 Branch: version.Branch,
371 Revision: version.Revision,
372 BuildUser: version.BuildUser,
373 BuildDate: version.BuildDate,
374 GoVersion: version.GoVersion,
375 },
376 }
377 output, err := json.Marshal(infoResponse)
378 if err != nil {
379 level.Error(h.logger).Log("msg", "marshal build info response", "error", err)
380 http.Error(writer, err.Error(), http.StatusInternalServerError)
381 return
382 }
383 writer.WriteHeader(http.StatusOK)
384 if _, err := writer.Write(output); err != nil {
385 level.Error(h.logger).Log("msg", "write build info response", "error", err)
386 }
387}

Callers 5

RegisterQueryAPIMethod · 0.45
TestIndexHandlerPrefixFunction · 0.45
TestIndexPageContentFunction · 0.45
TestBuildInfoAPIFunction · 0.45
WrapMethod · 0.45

Calls 4

MarshalMethod · 0.45
LogMethod · 0.45
ErrorMethod · 0.45
WriteMethod · 0.45

Tested by 3

TestIndexHandlerPrefixFunction · 0.36
TestIndexPageContentFunction · 0.36
TestBuildInfoAPIFunction · 0.36