Skip to content

Commit

Permalink
feat(sentry): enable sampling via http header (#20916)
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr authored Mar 14, 2024
1 parent 2ade095 commit 27ea285
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion posthog/settings/sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,13 @@ def traces_sampler(sampling_context: dict) -> float:

if op == "http.server":
path = sampling_context.get("wsgi_environ", {}).get("PATH_INFO")
force_sample = bool(sampling_context.get("wsgi_environ", {}).get("HTTP_FORCE_SAMPLE"))

# HTTP header to force sampling set
if force_sample:
return 1.0 # 100%
# Ingestion endpoints (high volume)
if path.startswith("/batch"):
elif path.startswith("/batch"):
return 0.00000001 # 0.000001%
# Ingestion endpoints (high volume)
elif path.startswith(("/capture", "/track", "/s", "/e")):
Expand Down

0 comments on commit 27ea285

Please sign in to comment.