From 750c59ca6a3589247462c7887c3a4ce36f38b2f3 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Thu, 9 Feb 2023 19:32:03 +0100 Subject: [PATCH] Increase sample rate for Sentry and introduce ENV variable --- config/initializers/sentry.rb | 4 ++-- docs/environment_variables.md | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index 515a4996..3ed6fb6b 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -30,10 +30,10 @@ Sentry.init do |config| when '/', '/ping' 0.00 # ignore health check else - 0.01 + ENV.fetch('SENTRY_TRACE_SAMPLE_RATE', 1.0).to_f end else - 0.0 # ignore all other transactions + ENV.fetch('SENTRY_TRACE_SAMPLE_RATE', 1.0).to_f # sample all other transactions end end end diff --git a/docs/environment_variables.md b/docs/environment_variables.md index 5579a733..d045cc39 100644 --- a/docs/environment_variables.md +++ b/docs/environment_variables.md @@ -9,6 +9,7 @@ The following environment variables are specifically support in CodeOcean and ar | `SENTRY_DSN` | ` ` | Specifies the [Sentry error reporting](https://sentry.io) endpoint for the Rails server | | `SENTRY_JAVASCRIPT_DSN` | ` ` | Specifies the [Sentry error reporting](https://sentry.io) endpoint for the frontend used by browsers | | `SENTRY_CURRENT_ENV` | ` ` | Specifies the [Sentry](https://sentry.io) environment used for error reporting | +| `SENTRY_TRACE_SAMPLE_RATE` | `1.0` | Specifies the sampling rate for traces in [Sentry](https://sentry.io) | | `RAILS_LOG_LEVEL` | `info` in production
`debug` in development | Specifies how many log messages to print. The available log levels are: `debug`, `info`, `warn`, `error`, `fatal`, and `unknown`. | | `RAILS_LOG_TO_STDOUT` | `false` in `production` | Enables the server to print log output to the command line | | `RAILS_SERVE_STATIC_FILES` | `true` in `development` and `test`
`false` in `production` and `staging` | Specifies whether the Rails server should be able to handle requests for non-dynamic resources (e.g., assets) |