Skip to content

API usage notification emails fire at 90%/100% while org is far below plan limit #7976

Description

@adamvialpando

Summary

Organisations on a 1M / 30-day plan are receiving "API use has reached 90%" and later ">100%" usage notification emails while their actual usage (usage page + Django admin) is well below the limit (~130k-190k of 1,000,000). Usage tracking itself is correct. Only the alert/notification percentage math is wrong.

Observed

  • Usage page and Django admin show ~130k-190k API calls for the period against a 1,000,000 plan limit.
  • Notification emails still fired 90%, then 100%+, over consecutive days.
  • No overage or service impact actually occurred.

Suspected cause (to validate)

The usage notification task appears to evaluate usage against the cached "Organisation subscription information cache" value rather than the actual plan limit. When that cache is stale or incorrect (holding a lower allowed-call figure than the real plan), the percentage is computed against the wrong denominator and trips the alert thresholds. Needs validation against handle_api_usage_notifications.

Steps to reproduce

  1. Find an org whose Organisation subscription information cache holds an allowed-API-call value lower than the org's actual plan limit.
  2. Ensure real usage exceeds that cached (wrong) value but is below the true plan limit.
  3. Allow the usage notification task to run.
  4. Observe 90%/100% alert emails fire despite real usage being well under the plan.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions