Skip to content

Commit

Permalink
@timestamp handling from opsgenie#165 (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
jylitalo authored Jul 6, 2023
1 parent 5814d29 commit c572daa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/kube/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type EnhancedEvent struct {
corev1.Event `json:",inline"`
ClusterName string `json:"clusterName"`
InvolvedObject EnhancedObjectReference `json:"involvedObject"`
Timestamp time.Time `json:"@timestamp"`
}

// DeDot replaces all dots in the labels and annotations with underscores. This is required for example in the
Expand Down Expand Up @@ -47,6 +48,7 @@ type EnhancedObjectReference struct {
// ToJSON does not return an error because we are %99 confident it is JSON serializable.
// TODO(makin) Is it a bad practice? It's open to discussion.
func (e *EnhancedEvent) ToJSON() []byte {
e.Timestamp = e.FirstTimestamp.Time
b, _ := json.Marshal(e)
return b
}
Expand Down

0 comments on commit c572daa

Please sign in to comment.