Skip to content

Instantly share code, notes, and snippets.

@tanan
Created February 26, 2018 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanan/97ce2c39f15cd5cfc85441f754228fd7 to your computer and use it in GitHub Desktop.
Save tanan/97ce2c39f15cd5cfc85441f754228fd7 to your computer and use it in GitHub Desktop.
prometheus router setting
router.Get("/", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, path.Join(o.ExternalURL.Path, "/graph"), http.StatusFound)
})
router.Get("/alerts", readyf(instrf("alerts", h.alerts)))
router.Get("/graph", readyf(instrf("graph", h.graph)))
router.Get("/status", readyf(instrf("status", h.status)))
router.Get("/flags", readyf(instrf("flags", h.flags)))
router.Get("/config", readyf(instrf("config", h.serveConfig)))
router.Get("/rules", readyf(instrf("rules", h.rules)))
router.Get("/targets", readyf(instrf("targets", h.targets)))
router.Get("/version", readyf(instrf("version", h.version)))
router.Get("/service-discovery", readyf(instrf("servicediscovery", h.serviceDiscovery)))
router.Get("/heap", instrf("heap", h.dumpHeap))
router.Get("/metrics", prometheus.Handler().ServeHTTP)
router.Get("/federate", readyf(instrh("federate", httputil.CompressionHandler{
Handler: http.HandlerFunc(h.federation),
})))
router.Get("/consoles/*filepath", readyf(instrf("consoles", h.consoles)))
router.Get("/static/*filepath", instrf("static", h.serveStaticAsset))
if o.UserAssetsPath != "" {
router.Get("/user/*filepath", instrf("user", route.FileServe(o.UserAssetsPath)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment