mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-05-25 08:32:05 +00:00
Fix Sentry sample rate calculation.
This commit is contained in:
4
fly.toml
4
fly.toml
@@ -49,7 +49,7 @@ soft_limit = 250
|
||||
[[services.http_checks]]
|
||||
protocol = "http"
|
||||
method = "get"
|
||||
path = "/"
|
||||
path = "/health"
|
||||
headers = { Health-Check = "🩺", Host = "localhost" }
|
||||
grace_period = "5s"
|
||||
interval = "2s"
|
||||
@@ -76,7 +76,7 @@ soft_limit = 250
|
||||
[[services.http_checks]]
|
||||
protocol = "https"
|
||||
method = "get"
|
||||
path = "/"
|
||||
path = "/health"
|
||||
headers = { Health-Check = "🩺", Host = "localhost" }
|
||||
grace_period = "5s"
|
||||
interval = "2s"
|
||||
|
||||
@@ -59,10 +59,19 @@ func InitObservability() {
|
||||
options.Environment = environment
|
||||
options.EnableLogs = enableLogs
|
||||
options.EnableTracing = enableTracing
|
||||
if environment == "development" {
|
||||
switch environment {
|
||||
case "development", "staging":
|
||||
options.TracesSampleRate = 1.0
|
||||
} else {
|
||||
options.TracesSampleRate = 60.0
|
||||
case "production":
|
||||
options.TracesSampler = func(ctx sentry.SamplingContext) float64 {
|
||||
if method, ok := ctx.Span.Data["http.request.method"].(string); ok {
|
||||
switch method {
|
||||
case "PUT", "DELETE", "POST":
|
||||
return 1.0
|
||||
}
|
||||
}
|
||||
return 0.05
|
||||
}
|
||||
}
|
||||
if err := sentry.Init(options); err != nil {
|
||||
log.Fatalf("sentry: %s\n", err)
|
||||
|
||||
Reference in New Issue
Block a user