-
-
Notifications
You must be signed in to change notification settings - Fork 231
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. (#1182) * refactor: remove unused Scheme references in Redis controller files - Removed the Scheme field from the Reconciler struct in rediscluster_controller.go, main.go, and rediscluster_controller_suite_test.go as it was not being utilized. - This cleanup enhances code clarity and maintainability by eliminating unnecessary components. Signed-off-by: drivebyer <[email protected]> * feat(cluster): add event recording functionality for RedisCluster controller - 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: drivebyer <[email protected]> * update Signed-off-by: drivebyer <[email protected]> --------- Signed-off-by: drivebyer <[email protected]>
- Loading branch information
Showing
10 changed files
with
37 additions
and
16 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
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
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
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