internal/controlplane: add telemetry http handler (#1353)

This commit is contained in:
Travis Groth 2020-09-01 09:22:24 -04:00 committed by GitHub
parent 8ab0dcb45b
commit 2e714c211e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View file

@ -11,6 +11,7 @@ import (
"github.com/pomerium/pomerium/internal/httputil" "github.com/pomerium/pomerium/internal/httputil"
"github.com/pomerium/pomerium/internal/log" "github.com/pomerium/pomerium/internal/log"
"github.com/pomerium/pomerium/internal/middleware" "github.com/pomerium/pomerium/internal/middleware"
"github.com/pomerium/pomerium/internal/telemetry"
"github.com/pomerium/pomerium/internal/telemetry/requestid" "github.com/pomerium/pomerium/internal/telemetry/requestid"
"github.com/pomerium/pomerium/internal/version" "github.com/pomerium/pomerium/internal/version"
) )
@ -35,6 +36,7 @@ func (srv *Server) addHTTPMiddleware() {
root.Use(log.UserAgentHandler("user_agent")) root.Use(log.UserAgentHandler("user_agent"))
root.Use(log.RefererHandler("referer")) root.Use(log.RefererHandler("referer"))
root.Use(log.RequestIDHandler("request-id")) root.Use(log.RequestIDHandler("request-id"))
root.Use(telemetry.HTTPStatsHandler(srv.name))
root.Use(middleware.Healthcheck("/ping", version.UserAgent())) root.Use(middleware.Healthcheck("/ping", version.UserAgent()))
root.HandleFunc("/healthz", httputil.HealthCheck) root.HandleFunc("/healthz", httputil.HealthCheck)
root.HandleFunc("/ping", httputil.HealthCheck) root.HandleFunc("/ping", httputil.HealthCheck)

View file

@ -44,6 +44,7 @@ type Server struct {
currentConfig atomicVersionedOptions currentConfig atomicVersionedOptions
configUpdated chan struct{} configUpdated chan struct{}
name string
} }
// NewServer creates a new Server. Listener ports are chosen by the OS. // NewServer creates a new Server. Listener ports are chosen by the OS.