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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rows synced doesn't exist #19469

Merged
merged 2 commits into from
Dec 21, 2023
Merged

fix: rows synced doesn't exist #19469

merged 2 commits into from
Dec 21, 2023

Conversation

raquelmsmith
Copy link
Member

Problem

I noticed a few days ago (and then forgot 😬 ) that we are getting a ton of errors for missing rows_synced key. https://posthog.sentry.io/issues/4640389037/?project=1899813&query=is:unresolved+!url:http://billing.dev.posthog.dev+usage&statsPeriod=14d&stream_index=0

Then today Cameron found this, which led me down a rabbit hole to realize that orgs aren't getting properly quota limited. Someone's billing limit will be set, but they are still accruing usage (and not being charged for it, thankfully).

I'm wondering if this is the culprit. I don't really know if my fix here is the right solution... does the key not exist in the usage record because it doesn't exist in billing?

Changes

.get()s the key instead of assuming it's there.

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

How did you test this code?

@raquelmsmith raquelmsmith requested a review from EDsCODE December 21, 2023 05:19
Copy link
Member

@EDsCODE EDsCODE left a comment

Choose a reason for hiding this comment

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

  1. If we want the safest option, we could just remove "rows_synced" for now until I loop back ready for billing
  2. I think it would make more sense if we returned the default payloads that would indicate 0 usage. So for resource_usage = new_usage.get(field, {<default usage schema>}) and resource_usage["todays_usage"] = todays_usage.get(field, 0)

@raquelmsmith
Copy link
Member Author

"rows_synced" is kinda all over the place, we'll try the default value, that's a good idea.

@raquelmsmith raquelmsmith enabled auto-merge (squash) December 21, 2023 16:36
@raquelmsmith raquelmsmith merged commit 5590acb into master Dec 21, 2023
71 checks passed
@raquelmsmith raquelmsmith deleted the fix/rows-synced-missing branch December 21, 2023 16:49
fuziontech pushed a commit that referenced this pull request Jan 4, 2024
* fix rows synced doesn't exist

* use default value
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.

2 participants