Skip to content
Snippets Groups Projects

[Admin Analytics] update stat items data types to float

Merged Administrator requested to merge naman/update-admin-analytics-data-types into main

Created by: thenamankumar

Graphql Int type only interfaces with int32 in go. For large-scale sg instances, the counts for some stat items can be > 2^32.

The BigInt data type in Graphql works with int64 in go but returns count as a string which has to be always typecasted to Number before operating on in JS.

The better solution is to use Float in graphql and float64 in go which will handle numbers up to 2^64 easily.

This PR converts all the admin analytics stat items data types from Int to Float in graphql and from int32 to float64 in go.

Test plan

  • Enable feature flag: admin-analytics-enabled
  • Go to /site-admin/analytics/users and check if the stats are loading.

Merge request reports

Merged by avatar (Jul 7, 2025 5:42pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Created by: muratsu

    Review: Approved

    Looks good to me.

    Please keep in mind that this will still use js number primitive and therefore be max value capped at 2^53-1. We would need to make the string conversion and use BigInt primitive if we need larger numbers.

  • Merged by: thenamankumar at 2022-07-11 19:00:24 UTC

Please register or sign in to reply
Loading