Skip to content

Commit 996ceaa

Browse files
authored
username fix (#42)
1 parent 99cc650 commit 996ceaa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

remappers/hostmetrics/process.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ func addProcessResources(resource pcommon.Resource, startTime time.Time) func(pm
279279
owner, _ := resource.Attributes().Get("process.owner")
280280
if owner.Str() != "" {
281281
dp.Attributes().PutStr("user.name", owner.Str())
282+
} else {
283+
dp.Attributes().PutStr("user.name", "undefined")
282284
}
283285
exec, _ := resource.Attributes().Get("process.executable.path")
284286
if exec.Str() != "" {
@@ -291,6 +293,8 @@ func addProcessResources(resource pcommon.Resource, startTime time.Time) func(pm
291293
cmdline, _ := resource.Attributes().Get("process.command_line")
292294
if cmdline.Str() != "" {
293295
dp.Attributes().PutStr("system.process.cmdline", cmdline.Str())
296+
} else {
297+
dp.Attributes().PutStr("system.process.cmdline", "undefined")
294298
}
295299
dp.Attributes().PutStr("system.process.cpu.start_time", startTimeStr)
296300
// Adding dummy value to process.state as "undefined", since this field is not

0 commit comments

Comments
 (0)