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

Method RegisterRulerAPI

pkg/api/api.go:371–395  ·  view source on GitHub ↗

RegisterRulerAPI registers routes associated with the Ruler API

(r *ruler.API)

Source from the content-addressed store, hash-verified

369
370// RegisterRulerAPI registers routes associated with the Ruler API
371func (a *API) RegisterRulerAPI(r *ruler.API) {
372 // Prometheus Rule API Routes
373 a.RegisterRoute(path.Join(a.cfg.PrometheusHTTPPrefix, "/api/v1/rules"), http.HandlerFunc(r.PrometheusRules), true, "GET")
374 a.RegisterRoute(path.Join(a.cfg.PrometheusHTTPPrefix, "/api/v1/alerts"), http.HandlerFunc(r.PrometheusAlerts), true, "GET")
375
376 // Ruler API Routes
377 a.RegisterRoute("/api/v1/rules", http.HandlerFunc(r.ListRules), true, "GET")
378 a.RegisterRoute("/api/v1/rules/{namespace}", http.HandlerFunc(r.ListRules), true, "GET")
379 a.RegisterRoute("/api/v1/rules/{namespace}/{groupName}", http.HandlerFunc(r.GetRuleGroup), true, "GET")
380 a.RegisterRoute("/api/v1/rules/{namespace}", http.HandlerFunc(r.CreateRuleGroup), true, "POST")
381 a.RegisterRoute("/api/v1/rules/{namespace}/{groupName}", http.HandlerFunc(r.DeleteRuleGroup), true, "DELETE")
382 a.RegisterRoute("/api/v1/rules/{namespace}", http.HandlerFunc(r.DeleteNamespace), true, "DELETE")
383
384 // Legacy Prometheus Rule API Routes
385 a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/api/v1/rules"), http.HandlerFunc(r.PrometheusRules), true, "GET")
386 a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/api/v1/alerts"), http.HandlerFunc(r.PrometheusAlerts), true, "GET")
387
388 // Legacy Ruler API Routes
389 a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/rules"), http.HandlerFunc(r.ListRules), true, "GET")
390 a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/rules/{namespace}"), http.HandlerFunc(r.ListRules), true, "GET")
391 a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/rules/{namespace}/{groupName}"), http.HandlerFunc(r.GetRuleGroup), true, "GET")
392 a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/rules/{namespace}"), http.HandlerFunc(r.CreateRuleGroup), true, "POST")
393 a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/rules/{namespace}/{groupName}"), http.HandlerFunc(r.DeleteRuleGroup), true, "DELETE")
394 a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/rules/{namespace}"), http.HandlerFunc(r.DeleteNamespace), true, "DELETE")
395}
396
397// RegisterOverrides registers routes associated with the Overrides API
398func (a *API) RegisterOverrides(o *overrides.API) {

Callers 1

initRulerMethod · 0.80

Calls 2

RegisterRouteMethod · 0.95
JoinMethod · 0.80

Tested by

no test coverage detected