File tree 2 files changed +8
-5
lines changed
2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -36,16 +36,19 @@ func generateUserAgent() string {
36
36
return fmt .Sprintf ("kubent (%s/%s)" , version , gitSha )
37
37
}
38
38
39
- func getCollectors (collectors []collector.Collector ) []map [string ]interface {} {
39
+ func getCollectors (collectors []collector.Collector , exitIfError bool ) []map [string ]interface {} {
40
40
var inputs []map [string ]interface {}
41
41
for _ , c := range collectors {
42
42
rs , err := c .Get ()
43
43
if err != nil {
44
44
log .Error ().Err (err ).Str ("name" , c .Name ()).Msg ("Failed to retrieve data from collector" )
45
- } else {
46
- inputs = append (inputs , rs ... )
47
- log .Info ().Str ("name" , c .Name ()).Msgf ("Retrieved %d resources from collector" , len (rs ))
45
+ if exitIfError {
46
+ os .Exit (EXIT_CODE_FAIL_GENERIC )
47
+ }
48
+ continue
48
49
}
50
+ inputs = append (inputs , rs ... )
51
+ log .Info ().Str ("name" , c .Name ()).Msgf ("Retrieved %d resources from collector" , len (rs ))
49
52
}
50
53
return inputs
51
54
}
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ func (c *ClusterCollector) Get() ([]map[string]interface{}, error) {
121
121
log .Debug ().Msgf ("Retrieving: %s.%s.%s" , g .Resource , g .Version , g .Group )
122
122
rs , err := ri .List (context .Background (), metav1.ListOptions {})
123
123
if err != nil {
124
- log .Debug ().Msgf ("Failed to retrieve: %s: %s" , g , err )
124
+ log .Warn ().Msgf ("Failed to retrieve: %s: %s" , g , err )
125
125
continue
126
126
}
127
127
You can’t perform that action at this time.
0 commit comments