kubernetes: Log the informer and provider names w/ debug log messages
@@ -33,7 +33,7 @@ func GetKubernetesEventHandlers(informerName, providerName string, shouldObserve
return cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
if !shouldObserve(obj) {
- logNotObservedNamespace(obj, eventTypes.Add)
+ logNotObservedNamespace(obj, eventTypes.Add, informerName, providerName)
return
}
events.GetPubSubInstance().Publish(events.PubSubMessage{
@@ -45,7 +45,7 @@ func GetKubernetesEventHandlers(informerName, providerName string, shouldObserve
UpdateFunc: func(oldObj, newObj interface{}) {
if !shouldObserve(newObj) {
- logNotObservedNamespace(newObj, eventTypes.Update)
+ logNotObservedNamespace(newObj, eventTypes.Update, informerName, providerName)
return
}
events.GetPubSubInstance().Publish(events.PubSubMessage{
@@ -57,7 +57,7 @@ func GetKubernetesEventHandlers(informerName, providerName string, shouldObserve
DeleteFunc: func(obj interface{}) {
if !shouldObserve(obj) {
- logNotObservedNamespace(obj, eventTypes.Delete)
+ logNotObservedNamespace(obj, eventTypes.Delete, informerName, providerName)
return
}
events.GetPubSubInstance().Publish(events.PubSubMessage{
@@ -73,8 +73,8 @@ func getNamespace(obj interface{}) string {
return reflect.ValueOf(obj).Elem().FieldByName("ObjectMeta").FieldByName("Namespace").String()
}
-func logNotObservedNamespace(obj interface{}, eventType a.AnnouncementType) {
+func logNotObservedNamespace(obj interface{}, eventType a.AnnouncementType, informerName, providerName string) {
if emitLogs {
- log.Debug().Msgf("Namespace %q is not observed by OSM; ignoring %s event", getNamespace(obj), eventType)
+ log.Debug().Msgf("Namespace %q is not observed by OSM; ignoring %s event; informer=%s; provider=%s", getNamespace(obj), eventType, informerName, providerName)
}
}
