From 12cd6786b71a81680bf698f8feb4b4aef0fa21de Mon Sep 17 00:00:00 2001 From: Cairry <115769353+Cairry@users.noreply.github.com> Date: Wed, 4 Sep 2024 09:56:30 +0800 Subject: [PATCH] Fix process username failed to obtain of the container process --- process.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/process.go b/process.go index 6236987..9cc91fa 100644 --- a/process.go +++ b/process.go @@ -66,7 +66,7 @@ func (pgc ProcessGaugeCollect) Collect(metric chan<- prometheus.Metric) { func registerMetric(proc *process.Process, pid int32, metric chan<- prometheus.Metric, pgc ProcessGaugeCollect) { user, err := proc.Username() if err != nil { - return + user = "unknown" } name, err := proc.Name()