Merge pull request #28304 from gavindsouza/enable-sentry-profiling
feat: Enable Sentry Sampling
This commit is contained in:
commit
85235d1252
4 changed files with 10 additions and 1 deletions
|
|
@ -476,6 +476,9 @@ if sentry_dsn := os.getenv("FRAPPE_SENTRY_DSN"):
|
|||
kwargs["traces_sample_rate"] = float(tracing_sample_rate)
|
||||
application = SentryWsgiMiddleware(application)
|
||||
|
||||
if profiling_sample_rate := os.getenv("SENTRY_PROFILING_SAMPLE_RATE"):
|
||||
kwargs["profiles_sample_rate"] = float(profiling_sample_rate)
|
||||
|
||||
sentry_sdk.init(
|
||||
dsn=sentry_dsn,
|
||||
before_send=before_send,
|
||||
|
|
|
|||
|
|
@ -445,7 +445,9 @@ before_job = [
|
|||
]
|
||||
|
||||
if os.getenv("FRAPPE_SENTRY_DSN") and (
|
||||
os.getenv("ENABLE_SENTRY_DB_MONITORING") or os.getenv("SENTRY_TRACING_SAMPLE_RATE")
|
||||
os.getenv("ENABLE_SENTRY_DB_MONITORING")
|
||||
or os.getenv("SENTRY_TRACING_SAMPLE_RATE")
|
||||
or os.getenv("SENTRY_PROFILING_SAMPLE_RATE")
|
||||
):
|
||||
before_request.append("frappe.utils.sentry.set_sentry_context")
|
||||
before_job.append("frappe.utils.sentry.set_sentry_context")
|
||||
|
|
|
|||
|
|
@ -695,6 +695,9 @@ def _start_sentry():
|
|||
if tracing_sample_rate := os.getenv("SENTRY_TRACING_SAMPLE_RATE"):
|
||||
kwargs["traces_sample_rate"] = float(tracing_sample_rate)
|
||||
|
||||
if profiling_sample_rate := os.getenv("SENTRY_PROFILING_SAMPLE_RATE"):
|
||||
kwargs["profiles_sample_rate"] = float(profiling_sample_rate)
|
||||
|
||||
sentry_sdk.init(
|
||||
dsn=sentry_dsn,
|
||||
before_send=before_send,
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ def capture_exception(message: str | None = None) -> None:
|
|||
if (
|
||||
os.getenv("ENABLE_SENTRY_DB_MONITORING") is None
|
||||
or os.getenv("SENTRY_TRACING_SAMPLE_RATE") is None
|
||||
or os.getenv("SENTRY_PROFILING_SAMPLE_RATE") is None
|
||||
):
|
||||
set_scope(scope)
|
||||
if frappe.request:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue