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

Method GetRuleGroup

pkg/ruler/api.go:534–554  ·  view source on GitHub ↗
(w http.ResponseWriter, req *http.Request)

Source from the content-addressed store, hash-verified

532}
533
534func (a *API) GetRuleGroup(w http.ResponseWriter, req *http.Request) {
535 logger := util_log.WithContext(req.Context(), a.logger)
536 userID, namespace, groupName, err := parseRequest(req, true, true)
537 if err != nil {
538 util_api.RespondError(logger, w, v1.ErrBadData, err.Error(), http.StatusBadRequest)
539 return
540 }
541
542 rg, err := a.store.GetRuleGroup(req.Context(), userID, namespace, groupName)
543 if err != nil {
544 if errors.Is(err, rulestore.ErrGroupNotFound) {
545 http.Error(w, err.Error(), http.StatusNotFound)
546 return
547 }
548 http.Error(w, err.Error(), http.StatusBadRequest)
549 return
550 }
551
552 formatted := rulespb.FromProto(rg)
553 marshalAndSend(formatted, w, logger)
554}
555
556func (a *API) CreateRuleGroup(w http.ResponseWriter, req *http.Request) {
557 logger := util_log.WithContext(req.Context(), a.logger)

Callers

nothing calls this directly

Calls 7

FromProtoFunction · 0.92
parseRequestFunction · 0.85
marshalAndSendFunction · 0.85
GetRuleGroupMethod · 0.65
ContextMethod · 0.45
ErrorMethod · 0.45
IsMethod · 0.45

Tested by

no test coverage detected