From 996ceaa4b09b37a3634fc8dce4d206d0e4974259 Mon Sep 17 00:00:00 2001 From: Ishleen Kaur <102962586+ishleenk17@users.noreply.github.com> Date: Mon, 8 Jul 2024 17:23:41 +0530 Subject: [PATCH] username fix (#42) --- remappers/hostmetrics/process.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/remappers/hostmetrics/process.go b/remappers/hostmetrics/process.go index 7f153b2..b851fe0 100644 --- a/remappers/hostmetrics/process.go +++ b/remappers/hostmetrics/process.go @@ -279,6 +279,8 @@ func addProcessResources(resource pcommon.Resource, startTime time.Time) func(pm owner, _ := resource.Attributes().Get("process.owner") if owner.Str() != "" { dp.Attributes().PutStr("user.name", owner.Str()) + } else { + dp.Attributes().PutStr("user.name", "undefined") } exec, _ := resource.Attributes().Get("process.executable.path") if exec.Str() != "" { @@ -291,6 +293,8 @@ func addProcessResources(resource pcommon.Resource, startTime time.Time) func(pm cmdline, _ := resource.Attributes().Get("process.command_line") if cmdline.Str() != "" { dp.Attributes().PutStr("system.process.cmdline", cmdline.Str()) + } else { + dp.Attributes().PutStr("system.process.cmdline", "undefined") } dp.Attributes().PutStr("system.process.cpu.start_time", startTimeStr) // Adding dummy value to process.state as "undefined", since this field is not