summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Xu <dxu@dxuuu.xyz>2024-01-04 10:24:36 -0800
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>2024-01-04 10:24:36 -0800
commitc8f76feaaf91bbfd648447b1d3ba53567eee07dd (patch)
tree850cc6465c210f80a8bfd8bbf0e43642e8aec59b
parent46b2db4ac8f94e1b3e2ffaed34347dd227d3622d (diff)
dump: openmetrics: Tag per-process stats with comm (#8218)
Summary: Currently per-process stats are only tagged with PID. While PID is useful, it's often even more useful for users to see the process/thread name. Otherwise it's anyone's guess what's actually running. Pull Request resolved: https://github.com/facebookincubator/below/pull/8218 Reviewed By: lnyng Differential Revision: D52543538 Pulled By: brianc118 fbshipit-source-id: c0403ca3d1fb325da792275d2cb5ba827fdfb98a
-rw-r--r--below/render/src/default_configs.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/below/render/src/default_configs.rs b/below/render/src/default_configs.rs
index 1bf9ee9d..a88098e9 100644
--- a/below/render/src/default_configs.rs
+++ b/below/render/src/default_configs.rs
@@ -923,16 +923,16 @@ impl HasRenderConfigForDump for model::SingleProcessModel {
use model::ProcessIoModelFieldId::*;
use model::ProcessMemoryModelFieldId::*;
use model::SingleProcessModelFieldId::*;
- let counter = if let Some(pid) = &self.pid {
- counter().label("pid", &pid.to_string())
- } else {
- counter()
- };
- let gauge = if let Some(pid) = &self.pid {
- gauge().label("pid", &pid.to_string())
- } else {
- gauge()
- };
+ let mut counter = counter();
+ let mut gauge = gauge();
+ if let Some(pid) = &self.pid {
+ counter = counter.label("pid", &pid.to_string());
+ gauge = gauge.label("pid", &pid.to_string());
+ }
+ if let Some(comm) = &self.comm {
+ counter = counter.label("comm", comm);
+ gauge = gauge.label("comm", comm);
+ }
match field_id {
// We will label all the other metrics with the pid
Pid => None,