@@ -40,11 +40,17 @@ type jobProbe struct {
4040}
4141
4242func dumpJob (job * batchv1.Job ) string {
43- return fmt .Sprintf ("job{Name: %s}" , job .GetName () )
43+ return fmt .Sprintf ("job{Namespace: %s, Name: %s}" , job .Namespace , job . Name )
4444}
4545
4646func (p * jobProbe ) newMetadata (job * batchv1.Job ) graph.Metadata {
47- return newMetadata ("job" , job .Namespace , job .GetName (), job )
47+ m := newMetadata ("job" , job .Namespace , job .Name , job )
48+ m .SetField ("Parallelism" , job .Spec .Parallelism )
49+ m .SetField ("Completions" , job .Spec .Completions )
50+ m .SetField ("Active" , job .Status .Active )
51+ m .SetField ("Succeeded" , job .Status .Succeeded )
52+ m .SetField ("Failed" , job .Status .Failed )
53+ return m
4854}
4955
5056func jobUID (job * batchv1.Job ) graph.Identifier {
@@ -66,8 +72,8 @@ func (p *jobProbe) OnUpdate(oldObj, newObj interface{}) {
6672 p .graph .Lock ()
6773 defer p .graph .Unlock ()
6874
69- if node := p .graph .GetNode (jobUID (job )); node != nil {
70- addMetadata (p .graph , node , job )
75+ if jobNode := p .graph .GetNode (jobUID (job )); jobNode != nil {
76+ addMetadata (p .graph , jobNode , job )
7177 logging .GetLogger ().Debugf ("Updated %s" , dumpJob (job ))
7278 }
7379 }
@@ -78,8 +84,8 @@ func (p *jobProbe) OnDelete(obj interface{}) {
7884 p .graph .Lock ()
7985 defer p .graph .Unlock ()
8086
81- if node := p .graph .GetNode (jobUID (job )); node != nil {
82- p .graph .DelNode (node )
87+ if jobNode := p .graph .GetNode (jobUID (job )); jobNode != nil {
88+ p .graph .DelNode (jobNode )
8389 logging .GetLogger ().Debugf ("Deleted %s" , dumpJob (job ))
8490 }
8591 }
0 commit comments