From 1238dfa5e901a6de6599a7e2daa8c26d93fa23c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Thu, 28 Dec 2023 11:33:22 +0100 Subject: [PATCH] feat: Add profiles_sample_rate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/AppInfo/Application.php | 1 + lib/Config.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index b61d15cd..131e4af3 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -74,6 +74,7 @@ public function boot(IBootContext $context): void { 'dsn' => $dsn, 'release' => $config->getServerVersion(), 'traces_sample_rate' => $config->getSamplingRate(), + 'profiles_sample_rate' => $config->getProfilesSamplingRate(), ]); } }); diff --git a/lib/Config.php b/lib/Config.php index c1a6a880..2013cb02 100644 --- a/lib/Config.php +++ b/lib/Config.php @@ -82,4 +82,18 @@ public function getSamplingRate(): float { }; } + public function getProfilesSamplingRate(): float { + $fromConfig = $this->config->getSystemValue('sentry.profiles-sampling-rate', null); + if ($fromConfig !== null) { + return $fromConfig; + } + + return match ($this->config->getSystemValueInt('loglevel', 2)) { + 0 => 1.0, + 1 => 0.7, + 2 => 0.3, + 3 => 0.2, + default => 0.1, + }; + } }