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