From 7386d5ff2e328697e3235b8ce3d00258c0fdd5ed Mon Sep 17 00:00:00 2001 From: Eshaan Date: Fri, 21 Nov 2025 01:40:10 +1100 Subject: [PATCH 1/2] Fix Sentry profiling by adding continuous profiling support Resolves #11493 This change updates the Sentry configuration to support continuous profiling, which is required for Sentry SDK versions 2.24.1 and later. Changes: - Added profile_session_sample_rate parameter to enable continuous profiling - Added profile_lifecycle parameter set to 'trace' mode for automatic profiling - Updated both openlibrary.yml and coverstore.yml configuration files - Maintained backward compatibility by keeping existing profiles_sample_rate The old transaction-based profiling (profiles_sample_rate) has been deprecated in favor of continuous profiling. This fix ensures profiling data is properly collected and sent to Sentry. --- conf/coverstore.yml | 3 +++ conf/openlibrary.yml | 3 +++ openlibrary/utils/sentry.py | 3 +++ 3 files changed, 9 insertions(+) diff --git a/conf/coverstore.yml b/conf/coverstore.yml index 44c538f481c..1bccde68766 100644 --- a/conf/coverstore.yml +++ b/conf/coverstore.yml @@ -13,4 +13,7 @@ sentry: # Dummy endpoint; where sentry logs are sent to dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0' traces_sample_rate: 1.0 + # Continuous profiling configuration (recommended for Sentry SDK >= 2.24.1) + profile_session_sample_rate: 0.001 + profile_lifecycle: 'trace' environment: 'local' diff --git a/conf/openlibrary.yml b/conf/openlibrary.yml index b46c4c427dc..a02fba168e0 100644 --- a/conf/openlibrary.yml +++ b/conf/openlibrary.yml @@ -178,6 +178,9 @@ sentry: dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0' traces_sample_rate: 1.0 profiles_sample_rate: 0.001 + # Continuous profiling configuration (recommended for Sentry SDK >= 2.24.1) + profile_session_sample_rate: 0.001 + profile_lifecycle: 'trace' environment: 'local' sentry_cron_jobs: diff --git a/openlibrary/utils/sentry.py b/openlibrary/utils/sentry.py index ac363674291..7766c2e789e 100644 --- a/openlibrary/utils/sentry.py +++ b/openlibrary/utils/sentry.py @@ -70,6 +70,9 @@ def init(self): environment=getenv('OL_SENTRY_ENVIRONMENT', self.config['environment']), traces_sample_rate=self.config.get('traces_sample_rate', 0.0), profiles_sample_rate=self.config.get('profiles_sample_rate', 0.0), + # Continuous profiling configuration + profile_session_sample_rate=self.config.get('profile_session_sample_rate', 0.0), + profile_lifecycle=self.config.get('profile_lifecycle', 'trace'), release=get_software_version(), ) From cd3c85e86bc0ef818cd3591f3c928e5bd57b1ade Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 20 Nov 2025 14:43:36 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- openlibrary/utils/sentry.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openlibrary/utils/sentry.py b/openlibrary/utils/sentry.py index 7766c2e789e..21bb1d6489d 100644 --- a/openlibrary/utils/sentry.py +++ b/openlibrary/utils/sentry.py @@ -71,7 +71,9 @@ def init(self): traces_sample_rate=self.config.get('traces_sample_rate', 0.0), profiles_sample_rate=self.config.get('profiles_sample_rate', 0.0), # Continuous profiling configuration - profile_session_sample_rate=self.config.get('profile_session_sample_rate', 0.0), + profile_session_sample_rate=self.config.get( + 'profile_session_sample_rate', 0.0 + ), profile_lifecycle=self.config.get('profile_lifecycle', 'trace'), release=get_software_version(), )