Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add option to track MAU stats (but not limit people) #3830

Merged
merged 11 commits into from
Nov 15, 2018

Conversation

turt2live
Copy link
Member

No description provided.

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

@turt2live please can you fix the conflict and the test failure?

@turt2live turt2live removed their assignment Sep 18, 2018
@turt2live turt2live requested a review from richvdh September 18, 2018 21:31
@richvdh richvdh requested review from a team and removed request for richvdh September 19, 2018 09:11
@richvdh richvdh dismissed their stale review September 19, 2018 13:48

test fixed

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

looks plausible to me, though since @neilisfragile wrote most of this code it might be sensible for him to take a look.

Copy link
Contributor

@neilisfragile neilisfragile left a comment

Choose a reason for hiding this comment

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

Looks good, my only ask is some tests to prove the logic - either in test/store/test_monthly_active_users or in the more integration-y test like test/test_mau.py

@@ -235,8 +235,12 @@ def populate_monthly_active_users(self, user_id):
# but only update if we have not previously seen the user for
# LAST_SEEN_GRANULARITY ms
if last_seen_timestamp is None:
count = yield self.get_monthly_active_count()
if count < self.hs.config.max_mau_value:
# Optimize the db usage when not limiting usage
Copy link
Contributor

Choose a reason for hiding this comment

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

I had to look at it a few times to understand the intent - I'm not sure I can suggest a more expressive way to do via code, but a more descriptive comment would be helpful.

I'm not sure it will necessarily help a great deal with db load since get_monthly_active_count is cached but the logic expects max_mau_value to be set and so I agree that it needs the if check.

Perhaps something like

"In the case where mau_stats_only is True and limit_usage_by_mau is False, there is no point in checking get_monthly_active_count - it adds no value and will break the logic if max_mau_value is exceeded "

Copy link
Member

Choose a reason for hiding this comment

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

I had to look at it a few times to understand the intent

(I had the same reaction tbh)

@turt2live
Copy link
Member Author

(fixed a conflict, haven't addressed anything else - will poke it Soon)

@turt2live
Copy link
Member Author

This was done with an unpaid hat on:

Signed-off-by: Travis Ralston travpc@gmail.com

@turt2live turt2live removed their assignment Oct 16, 2018
@neilisfragile
Copy link
Contributor

LGTM you happy @richvdh?

@Valodim
Copy link
Contributor

Valodim commented Nov 13, 2018

I'd love to have this functionality, can we get this merged?

@richvdh richvdh self-requested a review November 15, 2018 12:06
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

lgtm

@richvdh richvdh merged commit 835779f into matrix-org:develop Nov 15, 2018
@turt2live turt2live deleted the travis/mau-stats branch November 15, 2018 18:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants