Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

chore: new stats

Open hugocostadev opened this issue 1 year ago • 3 comments

Proposed changes (including videos or screenshots)

New stats for the cloud stats collector service

Issue(s)

Steps to test or reproduce

Further comments

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

hugocostadev avatar Aug 08 '24 16:08 hugocostadev

⚠️ No Changeset found

Latest commit: 831c994030b024ce34e189a6c99514d0b431f127

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

changeset-bot[bot] avatar Aug 08 '24 16:08 changeset-bot[bot]

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

dionisio-bot[bot] avatar Aug 08 '24 16:08 dionisio-bot[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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.

codecov[bot] avatar Aug 08 '24 16:08 codecov[bot]

@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

sampaiodiego avatar Sep 04 '24 14:09 sampaiodiego

@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 },
      },
   },
];

ricardogarim avatar Sep 04 '24 15:09 ricardogarim

Explains:

cc: @diegolmello @KevLehman

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

totalLivechatRoomsWithPriority image

activeUsersWithCustomRoles image

hugocostadev avatar Sep 06 '24 15:09 hugocostadev

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

github-actions[bot] avatar Sep 24 '24 14:09 github-actions[bot]

This PR currently has a merge conflict. Please resolve this and then re-add the ['stat: ready to merge', 'automerge'] label.

kodiakhq[bot] avatar Oct 15 '24 00:10 kodiakhq[bot]

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

ggazzo avatar Oct 16 '24 15:10 ggazzo