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

chore: improve the logging for quote limiting #28063

Merged
merged 3 commits into from
Feb 3, 2025

Conversation

zlwaterfield
Copy link
Contributor

@zlwaterfield zlwaterfield commented Jan 29, 2025

Changes

Building on: #27936

No functionality changes

  1. It looks like the task is being called, but I don't see the events from it, which is odd, so I'm throwing a sentry capture to try and see if an error is being thrown. I don't think the full sync for all orgs every 30 min is happening
  2. cleaning up logs with a single event and a type to make it easier to analyze.

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

Does this work well for both Cloud and self-hosted?

How did you test this code?

Updated tests

@zlwaterfield zlwaterfield self-assigned this Jan 29, 2025
@zlwaterfield zlwaterfield requested review from raquelmsmith and a team January 29, 2025 22:27
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR improves logging and error tracking for PostHog's quota limiting system by standardizing event names and adding Sentry integration for better observability.

  • Added Sentry error capturing in tasks.py to track failures in update_quota_limiting task
  • Consolidated quota limiting events under single event name org_quota_limited_until with event type property in quota_limiting.py
  • Added exception tracking for missing team tokens and usage data with standardized event properties
  • Updated test assertions in test_quota_limiting.py to match new logging format
  • Improved logging for update_all_orgs_billing_quotas with consistent event naming and properties

3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

@joshsny joshsny left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -177,8 +178,9 @@ def org_quota_limited_until(
if organization.never_drop_data or trust_score == 15:
report_organization_action(
organization,
"quota limiting ignored",
"org_quota_limited_until",
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we might want to rename to something generic since in some of these cases we are not rate limiting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't want to touch report_organization_action because those have been around for a while but yeah once I fix the underlying issue I'm going to revisit the core events here.

@zlwaterfield zlwaterfield merged commit 1133013 into master Feb 3, 2025
92 checks passed
@zlwaterfield zlwaterfield deleted the zach/improve-quote-logging branch February 3, 2025 21:07
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.

3 participants