Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

k8s events monitor handle empty event type #2282

Merged
merged 1 commit into from
Jun 17, 2022
Merged
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
9 changes: 7 additions & 2 deletions pkg/monitors/kubernetes/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ func k8sEventToSignalFxEvent(ev *v1.Event) *event.Event {
dims["kubernetes_name"] = ev.InvolvedObject.Name
dims["kubernetes_uid"] = string(ev.InvolvedObject.UID)
}

properties := utils.RemoveEmptyMapValues(map[string]string{
"message": ev.Message,
"source_component": ev.Source.Component,
Expand All @@ -186,8 +185,14 @@ func k8sEventToSignalFxEvent(ev *v1.Event) *event.Event {
"kubernetes_resource_version": ev.InvolvedObject.ResourceVersion,
})

eventType := ev.Reason
if eventType == "" {
logger.Debug("ev.Reason is not set; setting event type to unknown_reason")
eventType = "unknown_reason"
}

return event.NewWithProperties(
ev.Reason,
eventType,
event.AGENT,
utils.RemoveEmptyMapValues(dims),
utils.StringMapToInterfaceMap(properties),
Expand Down