From 82acba26afcf998b6ba76c7c1c035cb5b0df7de1 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 20 Dec 2021 19:42:26 +0100 Subject: [PATCH] internal: fix sentry sample rate not applying to proxy Signed-off-by: Jens Langhammer --- cmd/server/main.go | 2 +- internal/config/config.go | 5 +++-- internal/config/struct.go | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/server/main.go b/cmd/server/main.go index 97a74558f..53fef6dbb 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -41,7 +41,7 @@ func main() { err := sentry.Init(sentry.ClientOptions{ Dsn: config.G.ErrorReporting.DSN, AttachStacktrace: true, - TracesSampleRate: 0.6, + TracesSampleRate: config.G.ErrorReporting.SampleRate, Release: fmt.Sprintf("authentik@%s", constants.VERSION), Environment: config.G.ErrorReporting.Environment, }) diff --git a/internal/config/config.go b/internal/config/config.go index 8425a4bac..ee5e2b5b6 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -24,8 +24,9 @@ func DefaultConfig() { }, LogLevel: "info", ErrorReporting: ErrorReportingConfig{ - Enabled: false, - DSN: "https://a579bb09306d4f8b8d8847c052d3a1d3@sentry.beryju.org/8", + Enabled: false, + DSN: "https://a579bb09306d4f8b8d8847c052d3a1d3@sentry.beryju.org/8", + SampleRate: 1, }, } } diff --git a/internal/config/struct.go b/internal/config/struct.go index 359df5f64..e102fe8d3 100644 --- a/internal/config/struct.go +++ b/internal/config/struct.go @@ -42,4 +42,5 @@ type ErrorReportingConfig struct { Environment string `yaml:"environment" env:"AUTHENTIK_ERROR_REPORTING__ENVIRONMENT"` SendPII bool `yaml:"send_pii" env:"AUTHENTIK_ERROR_REPORTING__SEND_PII"` DSN string + SampleRate float64 `yaml:"sample_rate" env:"AUTHENTIK_ERROR_REPORTING__SAMPLE_RATE"` }