mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 09:23:09 -06:00
bla
This commit is contained in:
parent
ee146d1a78
commit
d1a89e71fc
|
|
@ -16,7 +16,6 @@ package main
|
|||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/matrix-org/dendrite/common/keydb"
|
||||
|
|
@ -32,8 +31,6 @@ import (
|
|||
"github.com/matrix-org/dendrite/roomserver"
|
||||
"github.com/matrix-org/dendrite/syncapi"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -82,10 +79,6 @@ func main() {
|
|||
}
|
||||
}()
|
||||
|
||||
// Set up prometheus metrics
|
||||
http.Handle("/metrics", promhttp.Handler())
|
||||
log.Fatal(http.ListenAndServe(":8080", nil))
|
||||
|
||||
// We want to block forever to let the HTTP and HTTPS handler serve the APIs
|
||||
select {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import (
|
|||
"github.com/matrix-org/dendrite/clientapi/auth/storage/devices"
|
||||
"github.com/matrix-org/dendrite/common"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/gorilla/mux"
|
||||
sarama "gopkg.in/Shopify/sarama.v1"
|
||||
|
||||
|
|
@ -134,9 +135,11 @@ func (b *BaseDendrite) CreateFederationClient() *gomatrixserverlib.FederationCli
|
|||
// ApiMux under /api/ and adds a prometheus handler under /metrics.
|
||||
func (b *BaseDendrite) SetupAndServeHTTP(addr string) {
|
||||
common.SetupHTTPAPI(http.DefaultServeMux, common.WrapHandlerInCORS(b.APIMux))
|
||||
|
||||
logrus.Infof("Starting %s server on %s", b.componentName, addr)
|
||||
|
||||
http.Handle("/metrics", promhttp.Handler())
|
||||
logrus.Infof("Starting %s Prometheus server at /metrics", b.componentName)
|
||||
|
||||
err := http.ListenAndServe(addr, nil)
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ func MakeFedAPI(
|
|||
func SetupHTTPAPI(servMux *http.ServeMux, apiMux http.Handler) {
|
||||
// This is deprecated.
|
||||
servMux.Handle("/metrics", prometheus.Handler()) // nolint: megacheck, staticcheck
|
||||
servMux.Handle("/metrics", promhttp.Handler())
|
||||
servMux.Handle("/api/", http.StripPrefix("/api", apiMux))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue