mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-27 04:07:08 +00:00
Move metrics from macaron to chi (#13601)
This commit is contained in:
parent
75ebf7c5bd
commit
9ec5e6c40b
3 changed files with 22 additions and 22 deletions
|
@ -17,12 +17,15 @@ import (
|
|||
"time"
|
||||
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/metrics"
|
||||
"code.gitea.io/gitea/modules/public"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/storage"
|
||||
"code.gitea.io/gitea/routers"
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
"github.com/go-chi/chi/middleware"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
type routerLoggerOptions struct {
|
||||
|
@ -251,6 +254,18 @@ func NormalRoutes() http.Handler {
|
|||
})
|
||||
}
|
||||
|
||||
r.Get("/apple-touch-icon.png", func(w http.ResponseWriter, req *http.Request) {
|
||||
http.Redirect(w, req, path.Join(setting.StaticURLPrefix, "img/apple-touch-icon.png"), 301)
|
||||
})
|
||||
|
||||
// prometheus metrics endpoint
|
||||
if setting.Metrics.Enabled {
|
||||
c := metrics.NewCollector()
|
||||
prometheus.MustRegister(c)
|
||||
|
||||
r.Get("/metrics", routers.Metrics)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue