|
|
|
@ -63,39 +63,39 @@ func (ws WebService) ServeForever(pathPrefix string) error {
|
|
|
|
|
http.Handle(pathPrefix, prometheus.InstrumentHandler( |
|
|
|
|
pathPrefix, ws.StatusHandler, |
|
|
|
|
)) |
|
|
|
|
http.Handle(pathPrefix + "alerts", prometheus.InstrumentHandler( |
|
|
|
|
pathPrefix + "alerts", ws.AlertsHandler, |
|
|
|
|
http.Handle(pathPrefix+"alerts", prometheus.InstrumentHandler( |
|
|
|
|
pathPrefix+"alerts", ws.AlertsHandler, |
|
|
|
|
)) |
|
|
|
|
http.Handle(pathPrefix + "consoles/", prometheus.InstrumentHandler( |
|
|
|
|
pathPrefix + "consoles/", http.StripPrefix(pathPrefix + "consoles/", ws.ConsolesHandler), |
|
|
|
|
http.Handle(pathPrefix+"consoles/", prometheus.InstrumentHandler( |
|
|
|
|
pathPrefix+"consoles/", http.StripPrefix(pathPrefix+"consoles/", ws.ConsolesHandler), |
|
|
|
|
)) |
|
|
|
|
http.Handle(pathPrefix + "graph", prometheus.InstrumentHandler( |
|
|
|
|
pathPrefix + "graph", ws.GraphsHandler, |
|
|
|
|
http.Handle(pathPrefix+"graph", prometheus.InstrumentHandler( |
|
|
|
|
pathPrefix+"graph", ws.GraphsHandler, |
|
|
|
|
)) |
|
|
|
|
http.Handle(pathPrefix + "heap", prometheus.InstrumentHandler( |
|
|
|
|
pathPrefix + "heap", http.HandlerFunc(dumpHeap), |
|
|
|
|
http.Handle(pathPrefix+"heap", prometheus.InstrumentHandler( |
|
|
|
|
pathPrefix+"heap", http.HandlerFunc(dumpHeap), |
|
|
|
|
)) |
|
|
|
|
|
|
|
|
|
ws.MetricsHandler.RegisterHandler(pathPrefix) |
|
|
|
|
http.Handle(pathPrefix + strings.TrimLeft(*metricsPath, "/"), prometheus.Handler()) |
|
|
|
|
http.Handle(pathPrefix+strings.TrimLeft(*metricsPath, "/"), prometheus.Handler()) |
|
|
|
|
if *useLocalAssets { |
|
|
|
|
http.Handle(pathPrefix + "static/", prometheus.InstrumentHandler( |
|
|
|
|
pathPrefix + "static/", http.StripPrefix(pathPrefix + "static/", http.FileServer(http.Dir("web/static"))), |
|
|
|
|
http.Handle(pathPrefix+"static/", prometheus.InstrumentHandler( |
|
|
|
|
pathPrefix+"static/", http.StripPrefix(pathPrefix+"static/", http.FileServer(http.Dir("web/static"))), |
|
|
|
|
)) |
|
|
|
|
} else { |
|
|
|
|
http.Handle(pathPrefix + "static/", prometheus.InstrumentHandler( |
|
|
|
|
pathPrefix + "static/", http.StripPrefix(pathPrefix + "static/", new(blob.Handler)), |
|
|
|
|
http.Handle(pathPrefix+"static/", prometheus.InstrumentHandler( |
|
|
|
|
pathPrefix+"static/", http.StripPrefix(pathPrefix+"static/", new(blob.Handler)), |
|
|
|
|
)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if *userAssetsPath != "" { |
|
|
|
|
http.Handle(pathPrefix + "user/", prometheus.InstrumentHandler( |
|
|
|
|
pathPrefix + "user/", http.StripPrefix(pathPrefix + "user/", http.FileServer(http.Dir(*userAssetsPath))), |
|
|
|
|
http.Handle(pathPrefix+"user/", prometheus.InstrumentHandler( |
|
|
|
|
pathPrefix+"user/", http.StripPrefix(pathPrefix+"user/", http.FileServer(http.Dir(*userAssetsPath))), |
|
|
|
|
)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if *enableQuit { |
|
|
|
|
http.Handle(pathPrefix + "-/quit", http.HandlerFunc(ws.quitHandler)) |
|
|
|
|
http.Handle(pathPrefix+"-/quit", http.HandlerFunc(ws.quitHandler)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if pathPrefix != "/" { |
|
|
|
|