Skip to content

Comments

Aggregate multiprocess replica metrics for console overview view#31850

Merged
SangJunBak merged 1 commit intomainfrom
jun/fix-replica-aggregation
Mar 13, 2025
Merged

Aggregate multiprocess replica metrics for console overview view#31850
SangJunBak merged 1 commit intomainfrom
jun/fix-replica-aggregation

Conversation

@SangJunBak
Copy link
Contributor

@SangJunBak SangJunBak commented Mar 10, 2025

We use this query in the Console to power the Environment Overview page and cluster replica graphs for the 14 day time period.

Motivation

Sibling PR to https://github.com/MaterializeInc/console/pull/3733. Query should reflect the duplicate code there

Gabor noticed the utilization graphs being broken for clusters with multiple processes.
https://materializeinc.slack.com/archives/CU7ELJ6E9/p1741596295446089

Tips for reviewer

Checklist

I've tested this manually, but I added a unit test in https://github.com/MaterializeInc/console/pull/3733

@SangJunBak SangJunBak requested a review from ParkMyCar March 10, 2025 20:22
@SangJunBak SangJunBak requested a review from a team as a code owner March 10, 2025 20:22
@SangJunBak SangJunBak marked this pull request as draft March 10, 2025 20:24
@SangJunBak SangJunBak force-pushed the jun/fix-replica-aggregation branch 2 times, most recently from bcb4c00 to 101dd01 Compare March 10, 2025 20:45
@SangJunBak SangJunBak marked this pull request as ready for review March 10, 2025 20:48
m.occurred_at,
m.replica_id,
r.size,
(SUM(m.cpu_nano_cores::float8) / (s.cpu_nano_cores * s.processes)) AS cpu_percent,
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be nice to pull out the total resource calculation, e.g. s.cpu_nano_cores * s.processes into its own CTE, but up to you!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I may err on not for a few reasons:

  • It's nice to have the processes aggregation happen in one CTE. Though we could probably improve the naming to something like replica_metrics_history_combined_processes
  • I think it'd actually make the query less readable!
  • We'd still need to include the same columns in the groupby
  • Stupid reason, but I'd have to change this on the Console side too 😭

Caveat is the groupby calculation doesn't really apply for s.cpu_nano_cores * s.processes. If there were more unrelated MFPs on this query however, I'd probably separate it

@SangJunBak SangJunBak force-pushed the jun/fix-replica-aggregation branch 3 times, most recently from a82b9f1 to f239d48 Compare March 12, 2025 17:55
We use this query in the Console to power the Environment Overview page and cluster replica graphs for the 14 day time period.
@SangJunBak SangJunBak force-pushed the jun/fix-replica-aggregation branch from f239d48 to 93f2d01 Compare March 12, 2025 21:26
@SangJunBak SangJunBak merged commit 26dbe94 into main Mar 13, 2025
80 checks passed
@SangJunBak SangJunBak deleted the jun/fix-replica-aggregation branch March 13, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants