sentry: Optionally enable tracing, with transactions and spans.

This commit is contained in:
Alex Vandiver 2024-02-15 17:15:30 +00:00 committed by Tim Abbott
parent 3cbce0c5c7
commit f64b9475c1
2 changed files with 6 additions and 0 deletions

View File

@ -138,6 +138,8 @@ LOGGING_SHOW_PID = False
# Sentry.io error defaults to off
SENTRY_DSN: Optional[str] = None
SENTRY_TRACE_RATE: float = 0.0
SENTRY_PROFILE_RATE: float = 0.1
SENTRY_FRONTEND_DSN: Optional[str] = None
SENTRY_FRONTEND_SAMPLE_RATE: float = 1.0
SENTRY_FRONTEND_TRACE_RATE: float = 0.1

View File

@ -51,6 +51,8 @@ def add_context(event: "Event", hint: "Hint") -> Optional["Event"]:
def setup_sentry(dsn: Optional[str], environment: str) -> None:
from django.conf import settings
if not dsn:
return
@ -80,6 +82,8 @@ def setup_sentry(dsn: Optional[str], environment: str) -> None:
# PII while having the identifiers needed to determine that an
# exception only affects a small subset of users or realms.
send_default_pii=True,
traces_sample_rate=settings.SENTRY_TRACE_RATE,
profiles_sample_rate=settings.SENTRY_PROFILE_RATE,
)
# Ignore all of the loggers from django.security that are for user