-
Notifications
You must be signed in to change notification settings - Fork 11
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
2023 slow statements fix #195
Conversation
2414e93
to
f94cd0f
Compare
We aggregate task events into a single task, to get around memory issues when there are millions
6dd7ce9
to
559d186
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of small things. We will need to create a ticket to come back to this PR.
apiserver/server_billable_handler.go
Outdated
// Check if the resource type is "task" | ||
row, err := rows.Event() | ||
|
||
if row != nil && row.ResourceType != "" && row.ResourceType == "task" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the row.ResourceType != "" is redundant if we are checking the row.ResourceType == "task"
apiserver/server_billable_handler.go
Outdated
key := fmt.Sprintf("%s-%s", row.OrgGUID, row.SpaceGUID) | ||
|
||
// Convert the price values to float | ||
priceInc, _ := strconv.ParseFloat(row.Price.IncVAT, 128) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ParseFloat should only get 32 or 64... We should switch back to 64 as it only returns a float64.
e9947eb
to
047af3e
Compare
What
Some organisations have many many tasks in their events list, which are typically one off quick scripts. The sheer amount of them causes a memory issue for node to handle on a statements page. This fix gathers all tasks and groups them into one aggregate event with a summed cost for all of them in one.
How to review
Deploy to a dev environment and then check the statements page. This really needs a huge number of task events (say 50k a day) to really see the benefit.
Who can review
Anyone who can deploy the app.
🚨⚠️ Please do not merge this pull request via the GitHub UI ⚠️ 🚨