Enable Sentry Performance Tracing

This commit is contained in:
Maximilian Paß
2023-02-02 15:07:37 +00:00
parent 9b76549083
commit 689344bd79
2 changed files with 11 additions and 1 deletions

View File

@ -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,
}
}

View File

@ -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: