Skip to content

Conversation

Weves
Copy link
Contributor

@Weves Weves commented May 8, 2025

Description

Fixes https://linear.app/danswer/issue/DAN-1953/fix-user-count-for-billing

How Has This Been Tested?

👀

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

@Weves Weves requested a review from a team as a code owner May 8, 2025 21:42
Copy link

vercel bot commented May 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 9, 2025 0:19am

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 modifies how user counts are calculated for billing purposes by switching to get_live_users_count, which provides a more accurate count by excluding API keys, external connector users, and invited users.

  • backend/onyx/db/auth.py: Introduces get_live_users_count function that filters out API keys and external permission users for accurate billing
  • backend/onyx/server/manage/users.py: Updates bulk invite and remove user endpoints to use get_live_users_count for tenant billing updates
  • Potential edge case: Ensure billing system properly handles transition from old counting method to new one to avoid billing discrepancies
  • Consider adding a migration plan to handle existing tenants' billing cycles

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

@Weves Weves merged commit 91831f4 into main May 9, 2025
10 of 11 checks passed
@Weves Weves deleted the user-count-issue branch May 9, 2025 00:19
ferdinandl007 pushed a commit to ferdinandl007/onyx that referenced this pull request May 19, 2025
* Fix user count

* Add helper + fix async function as well

* fix mypy

* Address RK comment
ZhipengHe pushed a commit to ZhipengHe/onyx that referenced this pull request Jun 6, 2025
* Fix user count

* Add helper + fix async function as well

* fix mypy

* Address RK comment
AnkitTukatek pushed a commit to TukaTek/onyx that referenced this pull request Sep 23, 2025
* Fix user count

* Add helper + fix async function as well

* fix mypy

* Address RK comment
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