From 40a07c3f57dd979d8e2bb6eb316d465ce3230586 Mon Sep 17 00:00:00 2001 From: James Rose Date: Mon, 12 Jun 2023 15:17:06 +0100 Subject: [PATCH] Reduce Sentry sample rate so that we don't hit our quota (#1691) - As we migrate more organisations onto the service we need to be more conservative. - This PR removes tracing on healthchecks entirely, whilst lowering everything else from 0.02 to 0.01. --- config/initializers/sentry.rb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index 3b7262837..596487d40 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -1,5 +1,24 @@ Sentry.init do |config| config.breadcrumbs_logger = %i[active_support_logger http_logger] config.enabled_environments = %w[production staging review] - config.traces_sample_rate = 0.2 + + config.traces_sampler = lambda do |sampling_context| + transaction_context = sampling_context[:transaction_context] + op = transaction_context[:op] + transaction_name = transaction_context[:name] + + case op + when /request/ + case transaction_name + when /health/ + 0.0 # ignore healthcheck requests + else + 0.01 + end + when /sidekiq/ + 0.001 + else + 0.0 # We don't care about performance of other things + end + end end