Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(decide): More meaningful profiling #17729

Merged
merged 1 commit into from Oct 3, 2023
Merged

Conversation

neilkakkar
Copy link
Collaborator

@neilkakkar neilkakkar commented Oct 3, 2023

Problem

The previous PR was a fail: #17712 - since there's only a fraction of requests that fall into the spiking category, and we were blowing through our budget with a higher sampling rate. (thanks for flagging @fuziontech !)

So, I spent some time going through the weeds of sentry source code (ugh the docs are terrible for this - ChatGPT hints were surprisingly useful!) - to find a way to sample based on request duration. Now, based on how long the request took, we can have varying sampling rates.

Also adds a few more spans to decide for better observability.

For best reviewing experience, hide whitespace changes in the diff.

Changes

馃憠 Stay up-to-date with PostHog coding conventions for a smoother review.

How did you test this code?

Run locally, setup a sentry DSN, find events come in appropriately for decide, and confirm other endpoints are not affected

@neilkakkar neilkakkar marked this pull request as ready for review October 3, 2023 10:32
Copy link
Member

@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really interested to see if this works!

return event if random() < 0.5 else None

except Exception:
return event if should_sample else None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit picking that this could be a pass or a log and line 43 would still take effect...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense! but out of laziness / not wanting to wait for tests to pass again, I''l go ahead and merge, will fix this if this PR doesn't work 馃槀 馃檲

@neilkakkar neilkakkar merged commit 9b85453 into master Oct 3, 2023
71 checks passed
@neilkakkar neilkakkar deleted the fix-sentry-decide branch October 3, 2023 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants