-
Notifications
You must be signed in to change notification settings - Fork 482
Report heap metrics from clusterd #33686
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
Conversation
8850a63 to
1519e89
Compare
65e8c30 to
0ddc09e
Compare
src/clusterd/src/usage_metrics.rs
Outdated
|
|
||
| let mut memory = None; | ||
| let mut swap = None; | ||
| for line in meminfo.lines() { |
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.
Do something like ProcStatus for parsing here.
| SqlScalarType::TimestampTz { precision: None }.nullable(false), | ||
| ) | ||
| .with_column("heap_bytes", SqlScalarType::UInt64.nullable(true)) | ||
| .with_column("heap_limit", SqlScalarType::UInt64.nullable(true)) |
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.
Add comment: Fields only at the end + nullable
antiguru
left a comment
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.
Reviewed in person, LGTM!
This commit extends the usage metrics provided by clusterd's `/api/usage-metrics` endpoint with the memory usage, as well as the effective heap (memory+swap) limit. As for the existing usage collection, we mainly focus on Linux support, for macOS we only provide the required stubs to make sure the code compiles and run.
This change makes the kubernetes orchestrator collect the new heap metrics reported by clusterd processes and report them to the controller, where they are added to the `mz_cluster_replica_metrics_history` relation.
This PR extends the usage metrics reporting in clusterd to also report the current memory usage and heap limit. environmentd then makes use of the new information to populate two new columns in
mz_cluster_replica_metrics_history:heap_bytesandheap_limit. The new columns will be useful in implementing the new "Memory Utilization" UI in the Console, especially in self-managed environments.Motivation
Closes https://github.com/MaterializeInc/database-issues/issues/9692
Tips for reviewer
Thanks to #33720, we won't be losing any data already in
mz_cluster_replica_metrics_historyby making this change. The new columns will have NULL for old measurements instead.Checklist
$T ⇔ Proto$Tmapping (possibly in a backwards-incompatible way), then it is tagged with aT-protolabel.