Skip to content

Commit

Permalink
resmgr: use better container names in dumps.
Browse files Browse the repository at this point in the history
Use PrettyName()-compatible container name dumps together with
container IDs in NRI evnet dumps.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
  • Loading branch information
klihub authored and askervin committed Sep 20, 2024
1 parent 542fe43 commit daafb63
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 2 additions & 5 deletions pkg/resmgr/cache/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,9 @@ func (p *pod) PrettyName() string {
}

namespace := p.GetNamespace()
switch namespace {
case "default":
p.prettyName = ""
case "":
if namespace == "" {
p.prettyName = "<unknown-namespace>/"
default:
} else {
p.prettyName = namespace + "/"
}

Expand Down
6 changes: 4 additions & 2 deletions pkg/resmgr/nri.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,8 @@ func (p *nriPlugin) dump(dir, event string, args ...interface{}) {
return
}

p.Info("%s %s %s/%s:%s", dir, event, pod.GetNamespace(), pod.GetName(), ctr.GetName())
p.Info("%s %s %s/%s/%s (%s)", dir, event,
pod.GetNamespace(), pod.GetName(), ctr.GetName(), ctr.GetId())
p.dumpDetails(dir, event, ctr)
} else {
if len(args) < 1 {
Expand Down Expand Up @@ -723,7 +724,8 @@ func (p *nriPlugin) dump(dir, event string, args ...interface{}) {
return
}

p.Info("%s %s %s/%s:%s", dir, event, pod.GetNamespace(), pod.GetName(), ctr.GetName())
p.Info("%s %s %s/%s/%s (%s)", dir, event,
pod.GetNamespace(), pod.GetName(), ctr.GetName(), ctr.GetId())
p.dumpDetails(dir, event, ctr)
p.dumpDetails(dir, event, res)
} else {
Expand Down

0 comments on commit daafb63

Please sign in to comment.