internal: skip tracing for go healthcheck and metrics endpoints

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2022-06-10 22:19:48 +02:00
parent 74ce9cc6fd
commit bdf76bb4b7
10 changed files with 55 additions and 10 deletions

View File

@ -10,6 +10,7 @@ import (
"github.com/prometheus/client_golang/prometheus/promhttp"
log "github.com/sirupsen/logrus"
"goauthentik.io/internal/config"
"goauthentik.io/internal/utils/sentry"
)
var (
@ -22,6 +23,7 @@ var (
func RunMetricsServer() {
m := mux.NewRouter()
l := log.WithField("logger", "authentik.router.metrics")
m.Use(sentry.SentryNoSampleMiddleware)
m.Path("/metrics").HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
promhttp.InstrumentMetricHandler(
prometheus.DefaultRegisterer, promhttp.HandlerFor(prometheus.DefaultGatherer, promhttp.HandlerOpts{
@ -30,7 +32,7 @@ func RunMetricsServer() {
).ServeHTTP(rw, r)
// Get upstream metrics
re, err := http.NewRequest("GET", "http://localhost:8000/metrics/", nil)
re, err := http.NewRequest("GET", "http://localhost:8000/-/metrics/", nil)
if err != nil {
l.WithError(err).Warning("failed to get upstream metrics")
return