diff --git a/cmd/ldap/main.go b/cmd/ldap/main.go index 8b56d229a7..68e4165c01 100644 --- a/cmd/ldap/main.go +++ b/cmd/ldap/main.go @@ -2,17 +2,13 @@ package main import ( "fmt" - "net/url" "os" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "goauthentik.io/internal/common" - "goauthentik.io/internal/config" "goauthentik.io/internal/constants" - "goauthentik.io/internal/debug" - "goauthentik.io/internal/outpost/ak" + "goauthentik.io/internal/outpost/ak/entrypoint" "goauthentik.io/internal/outpost/ak/healthcheck" "goauthentik.io/internal/outpost/ldap" ) @@ -25,65 +21,15 @@ Required environment variables: - AUTHENTIK_INSECURE: Skip SSL Certificate verification` var rootCmd = &cobra.Command{ - Long: helpMessage, - Version: constants.FullVersion(), - PersistentPreRun: func(cmd *cobra.Command, args []string) { - log.SetLevel(log.DebugLevel) - log.SetFormatter(&log.JSONFormatter{ - FieldMap: log.FieldMap{ - log.FieldKeyMsg: "event", - log.FieldKeyTime: "timestamp", - }, - DisableHTMLEscape: true, - }) - }, - Run: func(cmd *cobra.Command, args []string) { - debug.EnableDebugServer() - akURL := config.Get().AuthentikHost - if akURL == "" { - fmt.Println("env AUTHENTIK_HOST not set!") - fmt.Println(helpMessage) - os.Exit(1) - } - akToken := config.Get().AuthentikToken - if akToken == "" { - fmt.Println("env AUTHENTIK_TOKEN not set!") - fmt.Println(helpMessage) - os.Exit(1) - } - - akURLActual, err := url.Parse(akURL) + Long: helpMessage, + Version: constants.FullVersion(), + PersistentPreRun: common.PreRun, + RunE: func(cmd *cobra.Command, args []string) error { + err := entrypoint.OutpostMain("authentik.outpost.ldap", ldap.NewServer) if err != nil { - fmt.Println(err) fmt.Println(helpMessage) - os.Exit(1) - } - - ex := common.Init() - defer common.Defer() - go func() { - for { - <-ex - os.Exit(0) - } - }() - - ac := ak.NewAPIController(*akURLActual, akToken) - if ac == nil { - os.Exit(1) - } - defer ac.Shutdown() - - ac.Server = ldap.NewServer(ac) - - err = ac.Start() - if err != nil { - log.WithError(err).Panic("Failed to run server") - } - - for { - <-ex } + return err }, } diff --git a/cmd/proxy/main.go b/cmd/proxy/main.go index 4bb93f1e68..24aee3c933 100644 --- a/cmd/proxy/main.go +++ b/cmd/proxy/main.go @@ -2,17 +2,13 @@ package main import ( "fmt" - "net/url" "os" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "goauthentik.io/internal/common" - "goauthentik.io/internal/config" "goauthentik.io/internal/constants" - "goauthentik.io/internal/debug" - "goauthentik.io/internal/outpost/ak" + "goauthentik.io/internal/outpost/ak/entrypoint" "goauthentik.io/internal/outpost/ak/healthcheck" "goauthentik.io/internal/outpost/proxyv2" ) @@ -28,65 +24,15 @@ Optionally, you can set these: - AUTHENTIK_HOST_BROWSER: URL to use in the browser, when it differs from AUTHENTIK_HOST` var rootCmd = &cobra.Command{ - Long: helpMessage, - Version: constants.FullVersion(), - PersistentPreRun: func(cmd *cobra.Command, args []string) { - log.SetLevel(log.DebugLevel) - log.SetFormatter(&log.JSONFormatter{ - FieldMap: log.FieldMap{ - log.FieldKeyMsg: "event", - log.FieldKeyTime: "timestamp", - }, - DisableHTMLEscape: true, - }) - }, - Run: func(cmd *cobra.Command, args []string) { - debug.EnableDebugServer() - akURL := config.Get().AuthentikHost - if akURL == "" { - fmt.Println("env AUTHENTIK_HOST not set!") - fmt.Println(helpMessage) - os.Exit(1) - } - akToken := config.Get().AuthentikToken - if akToken == "" { - fmt.Println("env AUTHENTIK_TOKEN not set!") - fmt.Println(helpMessage) - os.Exit(1) - } - - akURLActual, err := url.Parse(akURL) + Long: helpMessage, + Version: constants.FullVersion(), + PersistentPreRun: common.PreRun, + RunE: func(cmd *cobra.Command, args []string) error { + err := entrypoint.OutpostMain("authentik.outpost.proxy", proxyv2.NewProxyServer) if err != nil { - fmt.Println(err) fmt.Println(helpMessage) - os.Exit(1) - } - - ex := common.Init() - defer common.Defer() - go func() { - for { - <-ex - os.Exit(0) - } - }() - - ac := ak.NewAPIController(*akURLActual, akToken) - if ac == nil { - os.Exit(1) - } - defer ac.Shutdown() - - ac.Server = proxyv2.NewProxyServer(ac) - - err = ac.Start() - if err != nil { - log.WithError(err).Panic("Failed to run server") - } - - for { - <-ex } + return err }, } diff --git a/cmd/rac/main.go b/cmd/rac/main.go index 2aecf80bf5..b265b07964 100644 --- a/cmd/rac/main.go +++ b/cmd/rac/main.go @@ -2,16 +2,13 @@ package main import ( "fmt" - "net/url" "os" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "goauthentik.io/internal/common" "goauthentik.io/internal/constants" - "goauthentik.io/internal/debug" - "goauthentik.io/internal/outpost/ak" + "goauthentik.io/internal/outpost/ak/entrypoint" "goauthentik.io/internal/outpost/ak/healthcheck" "goauthentik.io/internal/outpost/rac" ) @@ -24,65 +21,15 @@ Required environment variables: - AUTHENTIK_INSECURE: Skip SSL Certificate verification` var rootCmd = &cobra.Command{ - Long: helpMessage, - Version: constants.FullVersion(), - PersistentPreRun: func(cmd *cobra.Command, args []string) { - log.SetLevel(log.DebugLevel) - log.SetFormatter(&log.JSONFormatter{ - FieldMap: log.FieldMap{ - log.FieldKeyMsg: "event", - log.FieldKeyTime: "timestamp", - }, - DisableHTMLEscape: true, - }) - }, - Run: func(cmd *cobra.Command, args []string) { - debug.EnableDebugServer() - akURL, found := os.LookupEnv("AUTHENTIK_HOST") - if !found { - fmt.Println("env AUTHENTIK_HOST not set!") - fmt.Println(helpMessage) - os.Exit(1) - } - akToken, found := os.LookupEnv("AUTHENTIK_TOKEN") - if !found { - fmt.Println("env AUTHENTIK_TOKEN not set!") - fmt.Println(helpMessage) - os.Exit(1) - } - - akURLActual, err := url.Parse(akURL) + Long: helpMessage, + Version: constants.FullVersion(), + PersistentPreRun: common.PreRun, + RunE: func(cmd *cobra.Command, args []string) error { + err := entrypoint.OutpostMain("authentik.outpost.rac", rac.NewServer) if err != nil { - fmt.Println(err) fmt.Println(helpMessage) - os.Exit(1) - } - - ex := common.Init() - defer common.Defer() - go func() { - for { - <-ex - os.Exit(0) - } - }() - - ac := ak.NewAPIController(*akURLActual, akToken) - if ac == nil { - os.Exit(1) - } - defer ac.Shutdown() - - ac.Server = rac.NewServer(ac) - - err = ac.Start() - if err != nil { - log.WithError(err).Panic("Failed to run server") - } - - for { - <-ex } + return err }, } diff --git a/cmd/radius/main.go b/cmd/radius/main.go index 4e728b8854..0e797fc03a 100644 --- a/cmd/radius/main.go +++ b/cmd/radius/main.go @@ -2,16 +2,13 @@ package main import ( "fmt" - "net/url" "os" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "goauthentik.io/internal/common" "goauthentik.io/internal/constants" - "goauthentik.io/internal/debug" - "goauthentik.io/internal/outpost/ak" + "goauthentik.io/internal/outpost/ak/entrypoint" "goauthentik.io/internal/outpost/ak/healthcheck" "goauthentik.io/internal/outpost/radius" ) @@ -24,65 +21,15 @@ Required environment variables: - AUTHENTIK_INSECURE: Skip SSL Certificate verification` var rootCmd = &cobra.Command{ - Long: helpMessage, - Version: constants.FullVersion(), - PersistentPreRun: func(cmd *cobra.Command, args []string) { - log.SetLevel(log.DebugLevel) - log.SetFormatter(&log.JSONFormatter{ - FieldMap: log.FieldMap{ - log.FieldKeyMsg: "event", - log.FieldKeyTime: "timestamp", - }, - DisableHTMLEscape: true, - }) - }, - Run: func(cmd *cobra.Command, args []string) { - debug.EnableDebugServer() - akURL, found := os.LookupEnv("AUTHENTIK_HOST") - if !found { - fmt.Println("env AUTHENTIK_HOST not set!") - fmt.Println(helpMessage) - os.Exit(1) - } - akToken, found := os.LookupEnv("AUTHENTIK_TOKEN") - if !found { - fmt.Println("env AUTHENTIK_TOKEN not set!") - fmt.Println(helpMessage) - os.Exit(1) - } - - akURLActual, err := url.Parse(akURL) + Long: helpMessage, + Version: constants.FullVersion(), + PersistentPreRun: common.PreRun, + RunE: func(cmd *cobra.Command, args []string) error { + err := entrypoint.OutpostMain("authentik.outpost.radius", radius.NewServer) if err != nil { - fmt.Println(err) fmt.Println(helpMessage) - os.Exit(1) - } - - ex := common.Init() - defer common.Defer() - go func() { - for { - <-ex - os.Exit(0) - } - }() - - ac := ak.NewAPIController(*akURLActual, akToken) - if ac == nil { - os.Exit(1) - } - defer ac.Shutdown() - - ac.Server = radius.NewServer(ac) - - err = ac.Start() - if err != nil { - log.WithError(err).Panic("Failed to run server") - } - - for { - <-ex } + return err }, } diff --git a/cmd/server/server.go b/cmd/server/server.go index 4091c20957..85556ed304 100644 --- a/cmd/server/server.go +++ b/cmd/server/server.go @@ -22,21 +22,12 @@ import ( ) var rootCmd = &cobra.Command{ - Use: "authentik", - Short: "Start authentik instance", - Version: constants.FullVersion(), - PersistentPreRun: func(cmd *cobra.Command, args []string) { - log.SetLevel(log.DebugLevel) - log.SetFormatter(&log.JSONFormatter{ - FieldMap: log.FieldMap{ - log.FieldKeyMsg: "event", - log.FieldKeyTime: "timestamp", - }, - DisableHTMLEscape: true, - }) - }, + Use: "authentik", + Short: "Start authentik instance", + Version: constants.FullVersion(), + PersistentPreRun: common.PreRun, Run: func(cmd *cobra.Command, args []string) { - debug.EnableDebugServer() + debug.EnableDebugServer("authentik.core") l := log.WithField("logger", "authentik.root") if config.Get().ErrorReporting.Enabled { @@ -99,7 +90,7 @@ func attemptProxyStart(ws *web.WebServer, u *url.URL) { }) srv := proxyv2.NewProxyServer(ac) - ws.ProxyServer = srv + ws.ProxyServer = srv.(*proxyv2.ProxyServer) ac.Server = srv l.Debug("attempting to start outpost") err := ac.StartBackgroundTasks() diff --git a/go.mod b/go.mod index f7634d255b..f854e7b1ec 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( github.com/gorilla/securecookie v1.1.2 github.com/gorilla/sessions v1.4.0 github.com/gorilla/websocket v1.5.3 + github.com/grafana/pyroscope-go v1.2.2 github.com/jellydator/ttlcache/v3 v3.3.0 github.com/mitchellh/mapstructure v1.5.0 github.com/nmcclain/asn1-ber v0.0.0-20170104154839-2661553a0484 @@ -58,8 +59,10 @@ require ( github.com/go-openapi/strfmt v0.23.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect github.com/go-openapi/validate v0.24.0 // indirect + github.com/grafana/pyroscope-go/godeltaprof v0.1.8 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect + github.com/klauspost/compress v1.18.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oklog/ulid v1.3.1 // indirect diff --git a/go.sum b/go.sum index 61147d86ff..2d1625e2c6 100644 --- a/go.sum +++ b/go.sum @@ -178,6 +178,10 @@ github.com/gorilla/sessions v1.4.0/go.mod h1:FLWm50oby91+hl7p/wRxDth9bWSuk0qVL2e github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grafana/pyroscope-go v1.2.2 h1:uvKCyZMD724RkaCEMrSTC38Yn7AnFe8S2wiAIYdDPCE= +github.com/grafana/pyroscope-go v1.2.2/go.mod h1:zzT9QXQAp2Iz2ZdS216UiV8y9uXJYQiGE1q8v1FyhqU= +github.com/grafana/pyroscope-go/godeltaprof v0.1.8 h1:iwOtYXeeVSAeYefJNaxDytgjKtUuKQbJqgAIjlnicKg= +github.com/grafana/pyroscope-go/godeltaprof v0.1.8/go.mod h1:2+l7K7twW49Ct4wFluZD3tZ6e0SjanjcUUBPVD/UuGU= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -262,6 +266,8 @@ github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= diff --git a/internal/common/prerun.go b/internal/common/prerun.go new file mode 100644 index 0000000000..db2dfad029 --- /dev/null +++ b/internal/common/prerun.go @@ -0,0 +1,17 @@ +package common + +import ( + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +func PreRun(cmd *cobra.Command, args []string) { + log.SetLevel(log.DebugLevel) + log.SetFormatter(&log.JSONFormatter{ + FieldMap: log.FieldMap{ + log.FieldKeyMsg: "event", + log.FieldKeyTime: "timestamp", + }, + DisableHTMLEscape: true, + }) +} diff --git a/internal/debug/debug.go b/internal/debug/debug.go index 3897df12e5..bf77a0c7b2 100644 --- a/internal/debug/debug.go +++ b/internal/debug/debug.go @@ -5,19 +5,24 @@ import ( "fmt" "net/http" "net/http/pprof" + "os" + "runtime" "github.com/gorilla/mux" + "github.com/grafana/pyroscope-go" log "github.com/sirupsen/logrus" "goauthentik.io/internal/config" "goauthentik.io/internal/utils/web" ) -func EnableDebugServer() { - l := log.WithField("logger", "authentik.go_debugger") +var l = log.WithField("logger", "authentik.debugger.go") + +func EnableDebugServer(appName string) { if !config.Get().Debug { return } h := mux.NewRouter() + enablePyroscope(appName) h.HandleFunc("/debug/pprof/", pprof.Index) h.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline) h.HandleFunc("/debug/pprof/profile", pprof.Profile) @@ -54,3 +59,38 @@ func EnableDebugServer() { } }() } + +func enablePyroscope(appName string) { + p, pok := os.LookupEnv("AUTHENTIK_PYROSCOPE_HOST") + if !pok { + return + } + l.Debug("Enabling pyroscope") + runtime.SetMutexProfileFraction(5) + runtime.SetBlockProfileRate(5) + hostname, err := os.Hostname() + if err != nil { + panic(err) + } + _, err = pyroscope.Start(pyroscope.Config{ + ApplicationName: appName, + ServerAddress: p, + Logger: pyroscope.StandardLogger, + Tags: map[string]string{"hostname": hostname}, + ProfileTypes: []pyroscope.ProfileType{ + pyroscope.ProfileCPU, + pyroscope.ProfileAllocObjects, + pyroscope.ProfileAllocSpace, + pyroscope.ProfileInuseObjects, + pyroscope.ProfileInuseSpace, + pyroscope.ProfileGoroutines, + pyroscope.ProfileMutexCount, + pyroscope.ProfileMutexDuration, + pyroscope.ProfileBlockCount, + pyroscope.ProfileBlockDuration, + }, + }) + if err != nil { + panic(err) + } +} diff --git a/internal/outpost/ak/api.go b/internal/outpost/ak/api.go index 0d18fc6d1b..e68bb1e114 100644 --- a/internal/outpost/ak/api.go +++ b/internal/outpost/ak/api.go @@ -135,6 +135,10 @@ func NewAPIController(akURL url.URL, token string) *APIController { return ac } +func (a *APIController) Log() *log.Entry { + return a.logger +} + // Start Starts all handlers, non-blocking func (a *APIController) Start() error { err := a.Server.Refresh() diff --git a/internal/outpost/ak/entrypoint/entrypoint.go b/internal/outpost/ak/entrypoint/entrypoint.go new file mode 100644 index 0000000000..60a71bf090 --- /dev/null +++ b/internal/outpost/ak/entrypoint/entrypoint.go @@ -0,0 +1,51 @@ +package entrypoint + +import ( + "errors" + "net/url" + "os" + + "goauthentik.io/internal/common" + "goauthentik.io/internal/config" + "goauthentik.io/internal/debug" + "goauthentik.io/internal/outpost/ak" +) + +func OutpostMain(appName string, server func(ac *ak.APIController) ak.Outpost) error { + debug.EnableDebugServer(appName) + akURL := config.Get().AuthentikHost + if akURL == "" { + return errors.New("environment variable `AUTHENTIK_HOST` not set") + } + akToken := config.Get().AuthentikToken + if akToken == "" { + return errors.New("environment variable `AUTHENTIK_TOKEN` not set") + } + + akURLActual, err := url.Parse(akURL) + if err != nil { + return err + } + + ex := common.Init() + defer common.Defer() + + ac := ak.NewAPIController(*akURLActual, akToken) + if ac == nil { + os.Exit(1) + } + defer ac.Shutdown() + + ac.Server = server(ac) + + err = ac.Start() + if err != nil { + ac.Log().WithError(err).Panic("Failed to run server") + return err + } + + for { + <-ex + return nil + } +} diff --git a/internal/outpost/ak/global.go b/internal/outpost/ak/global.go index 4c1072082e..231f36d211 100644 --- a/internal/outpost/ak/global.go +++ b/internal/outpost/ak/global.go @@ -48,20 +48,20 @@ func doGlobalSetup(outpost api.Outpost, globalConfig *api.Config) { if globalConfig.ErrorReporting.Enabled { if !initialSetup { l.WithField("env", globalConfig.ErrorReporting.Environment).Debug("Error reporting enabled") - } - err := sentry.Init(sentry.ClientOptions{ - Dsn: globalConfig.ErrorReporting.SentryDsn, - Environment: globalConfig.ErrorReporting.Environment, - EnableTracing: true, - TracesSampler: sentryutils.SamplerFunc(float64(globalConfig.ErrorReporting.TracesSampleRate)), - Release: fmt.Sprintf("authentik@%s", constants.VERSION), - HTTPTransport: webutils.NewUserAgentTransport(constants.UserAgentOutpost(), http.DefaultTransport), - IgnoreErrors: []string{ - http.ErrAbortHandler.Error(), - }, - }) - if err != nil { - l.WithField("env", globalConfig.ErrorReporting.Environment).WithError(err).Warning("Failed to initialise sentry") + err := sentry.Init(sentry.ClientOptions{ + Dsn: globalConfig.ErrorReporting.SentryDsn, + Environment: globalConfig.ErrorReporting.Environment, + EnableTracing: true, + TracesSampler: sentryutils.SamplerFunc(float64(globalConfig.ErrorReporting.TracesSampleRate)), + Release: fmt.Sprintf("authentik@%s", constants.VERSION), + HTTPTransport: webutils.NewUserAgentTransport(constants.UserAgentOutpost(), http.DefaultTransport), + IgnoreErrors: []string{ + http.ErrAbortHandler.Error(), + }, + }) + if err != nil { + l.WithField("env", globalConfig.ErrorReporting.Environment).WithError(err).Warning("Failed to initialise sentry") + } } } diff --git a/internal/outpost/ldap/ldap.go b/internal/outpost/ldap/ldap.go index f9d4ad61bb..57d91e4ed4 100644 --- a/internal/outpost/ldap/ldap.go +++ b/internal/outpost/ldap/ldap.go @@ -26,7 +26,7 @@ type LDAPServer struct { providers []*ProviderInstance } -func NewServer(ac *ak.APIController) *LDAPServer { +func NewServer(ac *ak.APIController) ak.Outpost { ls := &LDAPServer{ log: log.WithField("logger", "authentik.outpost.ldap"), ac: ac, diff --git a/internal/outpost/proxyv2/proxyv2.go b/internal/outpost/proxyv2/proxyv2.go index 1a83081d35..690c6135f9 100644 --- a/internal/outpost/proxyv2/proxyv2.go +++ b/internal/outpost/proxyv2/proxyv2.go @@ -35,7 +35,7 @@ type ProxyServer struct { akAPI *ak.APIController } -func NewProxyServer(ac *ak.APIController) *ProxyServer { +func NewProxyServer(ac *ak.APIController) ak.Outpost { l := log.WithField("logger", "authentik.outpost.proxyv2") defaultCert, err := crypto.GenerateSelfSignedCert() if err != nil { diff --git a/internal/outpost/rac/rac.go b/internal/outpost/rac/rac.go index 1e9920305c..028ded0959 100644 --- a/internal/outpost/rac/rac.go +++ b/internal/outpost/rac/rac.go @@ -23,7 +23,7 @@ type RACServer struct { conns map[string]connection.Connection } -func NewServer(ac *ak.APIController) *RACServer { +func NewServer(ac *ak.APIController) ak.Outpost { rs := &RACServer{ log: log.WithField("logger", "authentik.outpost.rac"), ac: ac, diff --git a/internal/outpost/radius/radius.go b/internal/outpost/radius/radius.go index 2e98da0e6c..491ebff1a9 100644 --- a/internal/outpost/radius/radius.go +++ b/internal/outpost/radius/radius.go @@ -34,7 +34,7 @@ type RadiusServer struct { providers []*ProviderInstance } -func NewServer(ac *ak.APIController) *RadiusServer { +func NewServer(ac *ak.APIController) ak.Outpost { rs := &RadiusServer{ log: log.WithField("logger", "authentik.outpost.radius"), ac: ac, diff --git a/internal/utils/web/http_tracing.go b/internal/utils/web/http_tracing.go index 96c9a5211f..5ac1dbc1e8 100644 --- a/internal/utils/web/http_tracing.go +++ b/internal/utils/web/http_tracing.go @@ -2,7 +2,6 @@ package web import ( "context" - "fmt" "net/http" "github.com/getsentry/sentry-go" @@ -20,7 +19,7 @@ func NewTracingTransport(ctx context.Context, inner http.RoundTripper) *tracingT func (tt *tracingTransport) RoundTrip(r *http.Request) (*http.Response, error) { span := sentry.StartSpan(tt.ctx, "authentik.go.http_request") r.Header.Set("sentry-trace", span.ToSentryTrace()) - span.Description = fmt.Sprintf("%s %s", r.Method, r.URL.String()) + span.Description = r.Method + " " + r.URL.String() span.SetTag("url", r.URL.String()) span.SetTag("method", r.Method) defer span.Finish()