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

feat(metrics): add mutation to generate usage report #10236

Merged
merged 11 commits into from
Sep 24, 2024

Conversation

tianrunhe
Copy link
Contributor

@tianrunhe tianrunhe commented Sep 16, 2024

Description

Fixes #10001

The spec did mention another argument orgId to filter with a particular org but I don't want to get too complicated in the first version, especially considering in a month this query has to be re-written when we fully migrated MeetingMember and NewMeeting table to PG.

Demo

Screenshot 2024-09-23 at 10 22 42

Testing scenarios

mutation {
  runOrgActivityReport(
    startDate: "2024-01-01T00:00:00.000Z") {
    ... on RunOrgActivityReportSuccess {
      rows {
        monthStart
        signupCount
        participantCount
        meetingCount
      }
    }
    ... on ErrorPayload {
      error {
        message
      }
    }
  }
}

Final checklist

  • I checked the code review guidelines
  • I have added Metrics Representative as reviewer(s) if my PR invovles metrics/data/analytics related changes
  • I have performed a self-review of my code, the same way I'd do it for any other team member
  • I have tested all cases I listed in the testing scenarios and I haven't found any issues or regressions
  • Whenever I took a non-obvious choice I added a comment explaining why I did it this way
  • I added the label Skip Maintainer Review Indicating the PR only requires reviewer review and can be merged right after it's approved if the PR introduces only minor changes, does not contain any architectural changes or does not introduce any new patterns and I think one review is sufficient'
  • PR title is human readable and could be used in changelog

Copy link
Contributor

@Dschoordsch Dschoordsch left a comment

Choose a reason for hiding this comment

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

I get some strange results with the month end date

      {
          "monthStart": "2024-03-01T00:00:00.000Z",
          "lastDayOfMonth": "2024-03-30T23:00:00.000Z",
          "orgName": "All Organizations",
          "signupCount": 0,
          "loginCount": 0,
          "participantCount": 0,
          "meetingCount": 0
        },
        {
          "monthStart": "2024-04-01T00:00:00.000Z",
          "lastDayOfMonth": "2024-04-29T22:00:00.000Z",
          "orgName": "All Organizations",
          "signupCount": 0,
          "loginCount": 0,
          "participantCount": 0,
          "meetingCount": 0
        },

Note the time.

Also if I query for endDate: "2024-09-16T00:00:00.000Z" I get the result as

 {
          "monthStart": "2024-09-01T00:00:00.000Z",
          "lastDayOfMonth": "2024-09-29T22:00:00.000Z",

which is misleading, because we only count till the end date. I propose removing the lastDayOfMonth field.

@tianrunhe
Copy link
Contributor Author

tianrunhe commented Sep 23, 2024

I updated the code to remove the loginCount following this comment from Jordan. @Dschoordsch can you take another look? Thank you!

p.s. Also updated the screenshot & test GraphQL query

@tianrunhe tianrunhe merged commit b72decd into master Sep 24, 2024
7 checks passed
@tianrunhe tianrunhe deleted the feat/10001/orgActivityReport branch September 24, 2024 00:44
@github-actions github-actions bot mentioned this pull request Sep 24, 2024
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Historical usage reporting for self-hosted instances
2 participants