Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/collector/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,15 @@ func (ec *EventCollector) syncEvent(key string) error {
ec.cache[event.ObjectMeta.Name] = *event
ec.locker.Unlock()
klog.Infof(
"event name: %s,count: %d,involvedObject_namespace: %s,involvedObject_kind: %s,involvedObject_name: %s,reason: %s,type: %s",
"event name: %s,count: %d,involvedObject_namespace: %s,involvedObject_kind: %s,involvedObject_name: %s,reason: %s,type: %s, message: %s",
event.Name,
event.Count,
event.InvolvedObject.Namespace,
event.InvolvedObject.Kind,
event.InvolvedObject.Name,
event.Reason,
event.Type,
event.Message,
)
EventHandler(event)
}
Expand Down
8 changes: 6 additions & 2 deletions pkg/collector/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ var (
Subsystem: "",
Name: "count",
Help: "Number of kubernetes event happened",
}, []string{"name", "involved_object_namespace", "namespace", "involved_object_name", "involved_object_kind", "reason", "type", "source"})
}, []string{"name", "involved_object_namespace", "namespace", "involved_object_name", "involved_object_kind", "reason", "type", "message", "source"})
eventTotal = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "kube_event",
Subsystem: "",
Name: "unique_events_total",
Help: "Total number of kubernetes unique event happened",
}, []string{"name", "involved_object_namespace", "namespace", "involved_object_name", "involved_object_kind", "reason", "type", "source"})
}, []string{"name", "involved_object_namespace", "namespace", "involved_object_name", "involved_object_kind", "reason", "type", "message", "source"})
)

func increaseUniqueEventTotal(event *v1.Event) {
Expand All @@ -49,6 +49,7 @@ func increaseUniqueEventTotal(event *v1.Event) {
"involved_object_kind": event.InvolvedObject.Kind,
"reason": event.Reason,
"type": event.Type,
"message": event.Message,
"source": fmt.Sprintf("%s/%s", event.Source.Host, event.Source.Component),
}).Inc()
}
Expand All @@ -62,6 +63,7 @@ func updateEventCount(event *v1.Event) {
"involved_object_kind": event.InvolvedObject.Kind,
"reason": event.Reason,
"type": event.Type,
"message": event.Message,
"source": fmt.Sprintf("%s/%s", event.Source.Host, event.Source.Component),
}).Set(float64(event.Count))
}
Expand All @@ -75,6 +77,7 @@ func delEventCountMetric(event *v1.Event) {
"involved_object_kind": event.InvolvedObject.Kind,
"reason": event.Reason,
"type": event.Type,
"message": event.Message,
"source": fmt.Sprintf("%s/%s", event.Source.Host, event.Source.Component),
})
if ret {
Expand All @@ -91,6 +94,7 @@ func delEventTotalMetric(event *v1.Event) {
"involved_object_kind": event.InvolvedObject.Kind,
"reason": event.Reason,
"type": event.Type,
"message": event.Message,
"source": fmt.Sprintf("%s/%s", event.Source.Host, event.Source.Component),
})
if ret {
Expand Down