Closed yejingchen closed 4 years ago
@yejingchen I pushed a quick fix for this.
The issue is that the init function is called before loadConfig (which sets enable-prometheus). Therefore the config value is not found and the if statement evaluated false. I moved what was in the init function to the NewEventRouter function.
After commit 6a815be, the http
/metrics
interface gives no kubernetes events either withenable-prometheus
set totrue
or not specified at all. Events are indeed recorded because it is logged in glog.After fast skimming I think the
viper
imported ineventrouter.go
is not the same instance inmain.go
so the config doesn't apply. But since I don't know about go I maybe wrong. https://github.com/heptiolabs/eventrouter/blob/6a815beeeab89b29e5c283f7c793964b0b67e05a/eventrouter.go#L25