File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 77 "path"
88 "time"
99
10+ "github.com/VictoriaMetrics/VictoriaMetrics/app/vminsert"
11+ "github.com/VictoriaMetrics/VictoriaMetrics/app/vmselect"
12+ "github.com/VictoriaMetrics/VictoriaMetrics/app/vmstorage"
1013 conprofhttp "github.com/pingcap/ng-monitoring/component/conprof/http"
1114 "github.com/pingcap/ng-monitoring/component/topsql"
1215 "github.com/pingcap/ng-monitoring/config"
@@ -63,15 +66,33 @@ func ServeHTTP(l *config.Log, listener net.Listener) {
6366 promHandler .ServeHTTP (c .Writer , c .Request )
6467 })
6568
69+ wh := & wrapHeander {ngHanlder : ng }
6670 httpServer = & http.Server {
67- Handler : ng ,
71+ Handler : wh ,
6872 ReadHeaderTimeout : 5 * time .Second ,
6973 }
7074 if err = httpServer .Serve (listener ); err != nil && err != http .ErrServerClosed {
7175 log .Warn ("failed to serve http service" , zap .Error (err ))
7276 }
7377}
7478
79+ type wrapHeander struct {
80+ ngHanlder http.Handler
81+ }
82+
83+ func (wrap * wrapHeander ) ServeHTTP (w http.ResponseWriter , r * http.Request ) {
84+ if vminsert .RequestHandler (w , r ) {
85+ return
86+ }
87+ if vmselect .RequestHandler (w , r ) {
88+ return
89+ }
90+ if vmstorage .RequestHandler (w , r ) {
91+ return
92+ }
93+ wrap .ngHanlder .ServeHTTP (w , r )
94+ }
95+
7596type Status struct {
7697 Health bool `json:"health"`
7798}
You can’t perform that action at this time.
0 commit comments