in remappers/hostmetrics/process.go [272:305]
func addProcessResources(resource pcommon.Resource, startTime time.Time) func(pmetric.NumberDataPoint) {
startTimeStr := startTime.Format(time.RFC3339)
return func(dp pmetric.NumberDataPoint) {
ppid, _ := resource.Attributes().Get("process.parent_pid")
if ppid.Int() != 0 {
dp.Attributes().PutInt("process.parent.pid", ppid.Int())
}
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() != "" {
dp.Attributes().PutStr("process.executable", exec.Str())
}
name, _ := resource.Attributes().Get("process.executable.name")
if name.Str() != "" {
dp.Attributes().PutStr("process.name", name.Str())
}
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
// available through hostmetrics receiver currently and Process tab in curated
// UI's need this field as a prerequisite.
dp.Attributes().PutStr("system.process.state", "undefined")
}
}