Extricates reusable utilities for different alerting proxy types (#32268)

* backendtype helper

* abstracts alertingproxy

* updates alerting api dep

* prom endpoints
This commit is contained in:
Owen Diehl
2021-03-24 07:43:25 -04:00
committed by GitHub
parent 376ed8a381
commit 2179a2658e
8 changed files with 239 additions and 112 deletions
+9 -2
View File
@@ -45,11 +45,18 @@ type API struct {
// RegisterAPIEndpoints registers API handlers
func (api *API) RegisterAPIEndpoints() {
logger := log.New("ngalert.api")
proxy := &AlertingProxy{
DataProxy: api.DataProxy,
}
api.RegisterAlertmanagerApiEndpoints(AlertmanagerApiMock{log: logger})
api.RegisterPrometheusApiEndpoints(PrometheusApiMock{log: logger})
api.RegisterPrometheusApiEndpoints(NewForkedProm(
api.DatasourceCache,
NewLotexProm(proxy, logger),
PrometheusApiMock{log: logger},
))
api.RegisterRulerApiEndpoints(NewForkedRuler(
api.DatasourceCache,
&LotexRuler{DataProxy: api.DataProxy, log: logger},
NewLotexRuler(proxy, logger),
RulerApiMock{log: logger},
))
api.RegisterTestingApiEndpoints(TestingApiMock{log: logger})