Alerting: Allow hooking into request handler functions. (#67000)
* Alerting: Allow hooking into request handler functions. Adds a facility to AlertNG for hooking into API handlers, allowing the replacement of request handlers for specific paths. One of goals of this approach was to allow hooking as late as possible in the request, e.g. after all middleware has been applied, to simplfiy usage. * Update pkg/services/ngalert/api/hooks.go Co-authored-by: gotjosh <josue.abreu@gmail.com> * Update pkg/services/ngalert/api/hooks.go Co-authored-by: gotjosh <josue.abreu@gmail.com> * Update pkg/services/ngalert/ngalert.go Co-authored-by: gotjosh <josue.abreu@gmail.com> * Fixes to review comments * Fix passing logger in --------- Co-authored-by: gotjosh <josue.abreu@gmail.com>
This commit is contained in:
@@ -85,6 +85,9 @@ type API struct {
|
||||
Historian Historian
|
||||
|
||||
AppUrl *url.URL
|
||||
|
||||
// Hooks can be used to replace API handlers for specific paths.
|
||||
Hooks *Hooks
|
||||
}
|
||||
|
||||
// RegisterAPIEndpoints registers API handlers
|
||||
|
||||
Reference in New Issue
Block a user