Skip to content

Commit

Permalink
chore(data-warehouse): filter sensitive values (#18315)
Browse files Browse the repository at this point in the history
add handler
  • Loading branch information
EDsCODE authored Oct 31, 2023
1 parent 863aded commit c49fb0d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion posthog/settings/sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from datetime import timedelta


def before_send_transaction(event, hint):
def before_send(event, hint):
for exception in event.get("exception", {}).get("values", []):
for frame in exception.get("stacktrace", {}).get("frames", []):
args = frame.get("vars", {}).get("args", {})
Expand All @@ -24,6 +24,10 @@ def before_send_transaction(event, hint):
if "sensitive" in key:
frame["vars"]["args"][key] = "[Filtered]"

return event


def before_send_transaction(event, hint):
url_string = event.get("request", {}).get("url")
if url_string and "decide" in url_string:
DECIDE_SAMPLE_RATE = 0.00001 # 0.001%
Expand Down Expand Up @@ -155,6 +159,7 @@ def sentry_init() -> None:
# Configures the sample rate for error events, in the range of 0.0 to 1.0 (default).
# If set to 0.1 only 10% of error events will be sent. Events are picked randomly.
traces_sampler=traces_sampler,
before_send=before_send,
before_send_transaction=before_send_transaction,
_experiments={
# https://docs.sentry.io/platforms/python/profiling/
Expand Down

0 comments on commit c49fb0d

Please sign in to comment.