Skip to content

Conversation

bsekachev
Copy link
Member

@bsekachev bsekachev commented Jun 20, 2025

Motivation and context

We need a robust way to define when user used CVAT service.

It seems last_login field in User model may not get updated for more than a year if user works every day and do not do any logins. It does not seem reliable. Also, different auth methods (basic, social, sso) and a lot of code around make it difficult to guarantee that this field gets updated always.

Timestamps from analytics are not reliable also:

  1. User may send client events with future timestamps (probably it is a bug, but currently we already have some). Thus his account always have "recent" activity from the future.
  2. When user account scheduled for deletion, just opening CVAT account does not guarantee analytics will receive any logs from client (e.g. if browser closed immediately, or other issues in client code). Also, user may be authentificated via SDK/CLI what probably will not be displayed in analytics.

Finally, currently to find non-active users it is necessary to make many queries to the clickhouse database, so, usage report generation is much slower than with just postgres.

For me middleware with registering last activity once a day, seems the most reliable way.

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

@codecov-commenter
Copy link

codecov-commenter commented Jun 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.79%. Comparing base (5ce306e) to head (43fc5f7).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9554      +/-   ##
===========================================
+ Coverage    73.77%   73.79%   +0.01%     
===========================================
  Files          448      448              
  Lines        46712    46729      +17     
  Branches      3943     3943              
===========================================
+ Hits         34462    34483      +21     
+ Misses       12250    12246       -4     
Components Coverage Δ
cvat-ui 77.75% <ø> (+0.01%) ⬆️
cvat-server 70.71% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@bsekachev bsekachev merged commit 8da892b into develop Jun 24, 2025
72 of 75 checks passed
@bsekachev bsekachev deleted the bs/tracking_last_user_activity branch June 24, 2025 05:10
@cvat-bot cvat-bot bot mentioned this pull request Jun 25, 2025
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