From 8675f86d6102580ca750ece800bc754e4b34ecf8 Mon Sep 17 00:00:00 2001 From: Janos Rusiczki Date: Mon, 10 Apr 2023 18:52:35 +0300 Subject: [PATCH] Reduce Sentry sampling rate --- app/controllers/application_controller.rb | 3 ++- app/javascript/entrypoints/application.js | 2 +- app/serializers/configuration_serializer.rb | 2 +- config/initializers/sentry.rb | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 71626a2b..684efd92 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -19,7 +19,8 @@ def set_configuration_json users_sign_in_path:, users_sign_out_path:, users_settings_path:, - sentry_dsn: ENV.fetch('PHOTONIA_FE_SENTRY_DSN', '') + sentry_dsn: ENV.fetch('PHOTONIA_FE_SENTRY_DSN', ''), + sentry_sample_rate: ENV.fetch('PHOTONIA_FE_SENTRY_SAMPLE_RATE', 0.1).to_f ) ).serializable_hash.to_json end diff --git a/app/javascript/entrypoints/application.js b/app/javascript/entrypoints/application.js index 72c13964..423f3c2f 100644 --- a/app/javascript/entrypoints/application.js +++ b/app/javascript/entrypoints/application.js @@ -148,7 +148,7 @@ document.addEventListener('DOMContentLoaded', () => { // Set tracesSampleRate to 1.0 to capture 100% // of transactions for performance monitoring. // We recommend adjusting this value in production - tracesSampleRate: 0.5, + tracesSampleRate: cjda.sentry_sample_rate }); } diff --git a/app/serializers/configuration_serializer.rb b/app/serializers/configuration_serializer.rb index 761c878e..63ee07e7 100644 --- a/app/serializers/configuration_serializer.rb +++ b/app/serializers/configuration_serializer.rb @@ -3,5 +3,5 @@ class ConfigurationSerializer include JSONAPI::Serializer attributes :root_path, :graphql_url, :photos_path, :albums_path, :tags_path, :users_sign_in_path, - :users_sign_out_path, :users_settings_path, :sentry_dsn + :users_sign_out_path, :users_settings_path, :sentry_dsn, :sentry_sample_rate end diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index 71899602..144ed582 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -8,7 +8,7 @@ # Set traces_sample_rate to 1.0 to capture 100% # of transactions for performance monitoring. # We recommend adjusting this value in production. - config.traces_sample_rate = 0.5 + config.traces_sample_rate = ENV.fetch('PHOTONIA_BE_SENTRY_SAMPLE_RATE', 0.1).to_f # or # config.traces_sampler = lambda do |context|