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: new stats #33013

Merged
merged 13 commits into from
Oct 16, 2024
Merged

chore: new stats #33013

merged 13 commits into from
Oct 16, 2024

Conversation

hugocostadev
Copy link
Contributor

@hugocostadev hugocostadev commented Aug 8, 2024

Proposed changes (including videos or screenshots)

New stats for the cloud stats collector service

activeUsersWithCustomRoles
matrixFederation.amountOfMessagesInActiveFederatedRooms
chatsOnHold
omnichannelRoomsWithPriorities
businessHours.total
totalLivechatRoomsWithDepartment
totalPrivateApps
totalPrivateAppsEnabled

Issue(s)

Steps to test or reproduce

Further comments

https://rocketchat.atlassian.net/browse/CONN-312

Copy link

changeset-bot bot commented Aug 8, 2024

⚠️ No Changeset found

Latest commit: 831c994

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

dionisio-bot bot commented Aug 8, 2024

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is targeting the wrong base branch. It should target 7.1.0, but it targets 6.14.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

Copy link

codecov bot commented Aug 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.42%. Comparing base (2b8ac8a) to head (831c994).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #33013   +/-   ##
========================================
  Coverage    58.42%   58.42%           
========================================
  Files         2746     2746           
  Lines        66285    66285           
  Branches     15001    15001           
========================================
  Hits         38730    38730           
  Misses       24732    24732           
  Partials      2823     2823           
Flag Coverage Δ
unit 74.61% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@hugocostadev hugocostadev changed the title feat: new stats chore: new stats Aug 9, 2024
@hugocostadev hugocostadev marked this pull request as ready for review August 9, 2024 14:00
@hugocostadev hugocostadev requested review from a team as code owners August 9, 2024 14:00
apps/meteor/app/statistics/server/lib/statistics.ts Outdated Show resolved Hide resolved
tassoevan
tassoevan previously approved these changes Sep 3, 2024
Copy link
Member

@sampaiodiego sampaiodiego left a comment

Choose a reason for hiding this comment

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

I'm afraid the new queries might be too heavy for large deployments.. I'll take a look at them more carefully..

apps/meteor/server/models/raw/Users.js Outdated Show resolved Hide resolved
@sampaiodiego
Copy link
Member

@hugocostadev you can help testing that as well..

if you can provide some explain() results, running the new queries in database with like 1 million rooms and 500k users, it would be extremely helpful.. (explain docs)

maybe even use https://github.com/KevLehman/filler and expand it to rooms

@ricardogarim
Copy link
Contributor

@hugocostadev, there might be a cleaner way to handle the countLivechatRoomsByPriority function by removing the second group and simplifying the projection (see the example below). In this approach, you'll handle the responses (an array with priorityWeight names and their values) in the code, which will help avoid overloading the database when dealing with larger customers.

Edit: Also, just a thought — it could be worth testing a projection right after the match so we only pass the priorityWeight field along instead of the entire document. This might help optimize things a bit.

Updated aggregate query suggestion
const pipeline = [
   {
      $match: {
         t: 'l',
      },
   },
   {
      $project: {
         priorityWeight: 1,
      },
   },
   {
      $group: {
         _id: '$priorityWeight',
         count: { $sum: 1 },
      },
   },
];

apps/meteor/server/models/raw/Users.js Outdated Show resolved Hide resolved
apps/meteor/server/models/raw/Users.js Outdated Show resolved Hide resolved
apps/meteor/server/models/raw/LivechatRooms.ts Outdated Show resolved Hide resolved
apps/meteor/server/models/raw/LivechatRooms.ts Outdated Show resolved Hide resolved
apps/meteor/server/models/raw/Rooms.ts Outdated Show resolved Hide resolved
@hugocostadev
Copy link
Contributor Author

hugocostadev commented Sep 6, 2024

Explains:

cc: @diegolmello @KevLehman

Are those acceptable times? (1M rooms and 500k users)

totalLivechatRoomsWithPriority
image

activeUsersWithCustomRoles
image

Copy link
Contributor

github-actions bot commented Sep 24, 2024

PR Preview Action v1.4.8
🚀 Deployed preview to https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-33013/
on branch gh-pages at 2024-10-16 14:08 UTC

@KevLehman KevLehman added the stat: ready to merge PR tested and approved waiting for merge label Oct 16, 2024
@kodiakhq kodiakhq bot merged commit 8bbe581 into develop Oct 16, 2024
52 checks passed
@kodiakhq kodiakhq bot deleted the feat/new-stats branch October 16, 2024 14:45
@ggazzo
Copy link
Member

ggazzo commented Oct 16, 2024

the tag stat: ready to merge was applied incorrectly here, as the milestone was 7.1.0 it shouldn't be ready for merge

@KevLehman KevLehman modified the milestones: 7.1.0, 6.14, 7.0 Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants