From ae9cdb07f9759c390fb13e88f6550c8d7ad6ae86 Mon Sep 17 00:00:00 2001 From: Kev <6111995+k-fish@users.noreply.github.com> Date: Thu, 18 Jul 2024 16:01:58 -0400 Subject: [PATCH] feat(profiling): Allow profiling sample rate to be passed from env (#24) * feat(profiling): Allow profiling sample rate to be passed from env This sets a default profiling sample rate of 0 since not everyone may want profiling in CI due to cost concerns, but allows it to be enabled by passing it from the environment. * Should be a float --- pytest_sentry.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pytest_sentry.py b/pytest_sentry.py index 57db670..9e18463 100644 --- a/pytest_sentry.py +++ b/pytest_sentry.py @@ -86,6 +86,7 @@ def __init__(self, *args, **kwargs): "traces_sample_rate", float(os.environ.get("PYTEST_SENTRY_TRACES_SAMPLE_RATE", 1.0)), ) + kwargs.setdefault("profiles_sample_rate", float(os.environ.get("PYTEST_SENTRY_PROFILES_SAMPLE_RATE", 0.0))) kwargs.setdefault("_experiments", {}).setdefault( "auto_enabling_integrations", True )