From ab97e00d126ddc21db7a278ce1cd4e24e33e05d2 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Mon, 24 Apr 2023 19:58:34 +0800 Subject: [PATCH] fix(monitor): panic of StatisticHandler --- pkg/monitor/service/handlers.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/monitor/service/handlers.go b/pkg/monitor/service/handlers.go index 34ad1a6b1e..28bb5519a1 100644 --- a/pkg/monitor/service/handlers.go +++ b/pkg/monitor/service/handlers.go @@ -99,7 +99,7 @@ func InitInfluxDBSubscriptionHandlers(app *appsrv.Application, options *common_o root.UseEncodedPath() addCommonAlertDispatcher("", app) - addMiscHandlers(root) + addMiscHandlers(app, root) root.PathPrefix("").Handler(app) addr := net.JoinHostPort(options.Address, strconv.Itoa(options.Port)) @@ -119,10 +119,10 @@ func InitInfluxDBSubscriptionHandlers(app *appsrv.Application, options *common_o } } -func addMiscHandlers(root *mux.Router) { +func addMiscHandlers(app *appsrv.Application, root *mux.Router) { adapterF := func(appHandleFunc func(ctx context.Context, w http.ResponseWriter, r *http.Request)) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - appHandleFunc(context.TODO(), w, r) + appHandleFunc(app.GetContext(), w, r) } } root.HandleFunc("/subscriptions/write", adapterF(performHandler))