-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cluster): add event recording functionality for RedisCluster con…
…troller - Introduced a new events package to manage event recording, including a Recorder struct and methods for adding and retrieving events. - Updated the RedisCluster controller to utilize the event recorder, allowing it to log downscale events. - Enhanced the main function to initialize the event recorder for the RedisCluster controller. This update improves observability capabilities for RedisCluster operations. Signed-off-by: [Your Name] Signed-off-by: drivebyer <[email protected]>
- Loading branch information
Showing
4 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package events | ||
|
||
const ( | ||
EventReasonRedisClusterDownscale = "RedisClusterDownscale" | ||
) | ||
|
||
type Event struct { | ||
EventType string | ||
Reason string | ||
Message string | ||
} | ||
|
||
type Recorder struct { | ||
events []Event | ||
} | ||
|
||
func NewRecorder() *Recorder { | ||
return &Recorder{events: []Event{}} | ||
} | ||
|
||
func (r *Recorder) AddEvent(typ, reason, message string) { | ||
if r.events == nil { | ||
r.events = []Event{} | ||
} | ||
r.events = append(r.events, Event{EventType: typ, Reason: reason, Message: message}) | ||
} | ||
|
||
func (r *Recorder) Events() []Event { | ||
return r.events | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters