PostHog / plugin-server

Service to process and save PostHog events, supporting JS/TS plugins at that
https://posthog.com
8 stars 5 forks source link

nicer handling of insert distinct id failure #527

Closed yakkomajuri closed 3 years ago

yakkomajuri commented 3 years ago

Changes

I did some digging and turns out Postgres errors like 20-40 times per minute trying to insert a distinct ID that already exists. More context on #526

The plugin server handles this properly yet it swallows the errors, while Postgres creates a bit of logspam for what is an expected error for our system. This is similar to #523

Ultimately, this means that on Cloud we're doing tens of thousands of unnecessary queries a day just for distinct ID inserts, but I think any potential solution at this stage might just be over-engineering and would still be prone to race conditons, even if it shortens the window for them to happen.

Anyway, so this just silences unnecessary Postgres errors while making sure the errors we do care about are actually captured in Sentry.

Checklist