From 689344bd79b1641f0c3efa15c43b9b33b14db50c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Pa=C3=9F?= <22845248+mpass99@users.noreply.github.com> Date: Thu, 2 Feb 2023 15:07:37 +0000 Subject: [PATCH] Enable Sentry Performance Tracing --- cmd/poseidon/main.go | 6 +++++- configuration.example.yaml | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/poseidon/main.go b/cmd/poseidon/main.go index b267d28..e4cb116 100644 --- a/cmd/poseidon/main.go +++ b/cmd/poseidon/main.go @@ -4,6 +4,7 @@ import ( "context" "errors" "github.com/getsentry/sentry-go" + sentryhttp "github.com/getsentry/sentry-go/http" "github.com/openHPI/poseidon/internal/api" "github.com/openHPI/poseidon/internal/config" "github.com/openHPI/poseidon/internal/environment" @@ -102,6 +103,9 @@ func initServer() *http.Server { runnerManager, environmentManager = createManagerHandler(createAWSManager, config.Config.AWS.Enabled, runnerManager, environmentManager) + handler := api.NewRouter(runnerManager, environmentManager) + sentryHandler := sentryhttp.New(sentryhttp.Options{}).Handle(handler) + return &http.Server{ Addr: config.Config.Server.URL().Host, // A WriteTimeout would prohibit long-running requests such as creating an execution environment. @@ -110,7 +114,7 @@ func initServer() *http.Server { ReadHeaderTimeout: time.Second * 15, ReadTimeout: time.Second * 15, IdleTimeout: time.Second * 60, - Handler: api.NewRouter(runnerManager, environmentManager), + Handler: sentryHandler, } } diff --git a/configuration.example.yaml b/configuration.example.yaml index a951146..c74e778 100644 --- a/configuration.example.yaml +++ b/configuration.example.yaml @@ -71,6 +71,12 @@ sentry: # This release information is used by Poseidon to provide the version route. # Normally it is set by the deployment process. # release: this is replaced in the deployment process + # In debug mode, the debug information is printed to stdout to help you understand what sentry is doing. + # debug: true + # Enable performance tracing. + # enabletracing: true + # The sample rate for sampling traces in the range [0.0, 1.0]. + # tracessamplerate: 1.0 # Configuration of the influxdb monitoring influxdb: