From bd280c93a5f9178ac991ef55e3ab5f35f1bb8733 Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Wed, 25 Oct 2023 16:12:14 -0400 Subject: [PATCH] Add setting for sentry profiling configuration --- composed_configuration/_sentry.py | 9 +++++---- composed_configuration/sentry/apps.py | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/composed_configuration/_sentry.py b/composed_configuration/_sentry.py index 58b687e..008d459 100644 --- a/composed_configuration/_sentry.py +++ b/composed_configuration/_sentry.py @@ -13,8 +13,8 @@ class SentryMixin(ConfigMixin): The `DJANGO_SENTRY_DSN` environment variable should be externally set to a Sentry DSN. - The `DJANGO_SENTRY_ENVIRONMENT`, `DJANGO_SENTRY_RELEASE`, and `DJANGO_SENTRY_TRACES_SAMPLE_RATE` - environment variables may also be set, if desired. + The `DJANGO_SENTRY_ENVIRONMENT`, `DJANGO_SENTRY_RELEASE`, `DJANGO_SENTRY_TRACES_SAMPLE_RATE`, + and `DJANGO_SENTRY_PROFILES_SAMPLE_RATE` environment variables may also be set, if desired. """ @staticmethod @@ -29,6 +29,7 @@ def mutate_configuration(configuration: Type[ComposedConfiguration]) -> None: SENTRY_RELEASE = values.Value(None) - # None is a valid default value, but if this is set via environment variable, - # the value must be interpretable as a float + # None is a valid default value for these rates, but if set via environment variable, + # the values must be interpretable as floats SENTRY_TRACES_SAMPLE_RATE = values.FloatValue(None) + SENTRY_PROFILES_SAMPLE_RATE = values.FloatValue(None) diff --git a/composed_configuration/sentry/apps.py b/composed_configuration/sentry/apps.py index a0b078f..5c99dd5 100644 --- a/composed_configuration/sentry/apps.py +++ b/composed_configuration/sentry/apps.py @@ -29,6 +29,7 @@ def ready(self): attach_stacktrace=True, # Submit request User info from Django send_default_pii=True, - # This is None by default, so performance monitoring is opt-in + # These are None by default, so performance monitoring/profiling is opt-in traces_sample_rate=settings.SENTRY_TRACES_SAMPLE_RATE, + profiles_sample_rate=settings.SENTRY_PROFILES_SAMPLE_RATE, )