Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert local sdk logging from Debug->Info #1443

Merged
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
32 changes: 16 additions & 16 deletions pkg/sdkserver/localsdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ func NewLocalSDKServer(filePath string) (*LocalSDKServer, error) {
if event.Op != fsnotify.Write {
continue
}
logrus.WithField("event", event).Debug("File has been changed!")
logrus.WithField("event", event).Info("File has been changed!")
err := l.setGameServerFromFilePath(filePath)
if err != nil {
logrus.WithError(err).Error("error setting GameServer from file")
continue
}
logrus.Debug("Sending watched GameServer!")
logrus.Info("Sending watched GameServer!")
l.update <- struct{}{}
}
}()
Expand All @@ -129,7 +129,7 @@ func NewLocalSDKServer(filePath string) (*LocalSDKServer, error) {

go func() {
for value := range l.update {
logrus.Debug("Gameserver update received")
logrus.Info("Gameserver update received")
l.updateObservers.Range(func(observer, _ interface{}) bool {
observer.(chan struct{}) <- value
return true
Expand Down Expand Up @@ -196,7 +196,7 @@ func (l *LocalSDKServer) updateState(newState agonesv1.GameServerState) {

// Ready logs that the Ready request has been received
func (l *LocalSDKServer) Ready(context.Context, *sdk.Empty) (*sdk.Empty, error) {
logrus.Debug("Ready request has been received!")
logrus.Info("Ready request has been received!")
l.recordRequest("ready")
l.gsMutex.Lock()
defer l.gsMutex.Unlock()
Expand All @@ -210,7 +210,7 @@ func (l *LocalSDKServer) Ready(context.Context, *sdk.Empty) (*sdk.Empty, error)

// Allocate logs that an allocate request has been received
func (l *LocalSDKServer) Allocate(context.Context, *sdk.Empty) (*sdk.Empty, error) {
logrus.Debug("Allocate request has been received!")
logrus.Info("Allocate request has been received!")
l.recordRequest("allocate")
l.gsMutex.Lock()
defer l.gsMutex.Unlock()
Expand All @@ -223,7 +223,7 @@ func (l *LocalSDKServer) Allocate(context.Context, *sdk.Empty) (*sdk.Empty, erro

// Shutdown logs that the shutdown request has been received
func (l *LocalSDKServer) Shutdown(context.Context, *sdk.Empty) (*sdk.Empty, error) {
logrus.Debug("Shutdown request has been received!")
logrus.Info("Shutdown request has been received!")
l.recordRequest("shutdown")
l.gsMutex.Lock()
defer l.gsMutex.Unlock()
Expand All @@ -238,20 +238,20 @@ func (l *LocalSDKServer) Health(stream sdk.SDK_HealthServer) error {
for {
_, err := stream.Recv()
if err == io.EOF {
logrus.Debug("Health stream closed.")
logrus.Info("Health stream closed.")
return stream.SendAndClose(&sdk.Empty{})
}
if err != nil {
return errors.Wrap(err, "Error with Health check")
}
l.recordRequest("health")
logrus.Debug("Health Ping Received!")
logrus.Info("Health Ping Received!")
}
}

// SetLabel applies a Label to the backing GameServer metadata
func (l *LocalSDKServer) SetLabel(_ context.Context, kv *sdk.KeyValue) (*sdk.Empty, error) {
logrus.WithField("values", kv).Debug("Setting label")
logrus.WithField("values", kv).Info("Setting label")
l.gsMutex.Lock()
defer l.gsMutex.Unlock()

Expand All @@ -270,7 +270,7 @@ func (l *LocalSDKServer) SetLabel(_ context.Context, kv *sdk.KeyValue) (*sdk.Emp

// SetAnnotation applies a Annotation to the backing GameServer metadata
func (l *LocalSDKServer) SetAnnotation(_ context.Context, kv *sdk.KeyValue) (*sdk.Empty, error) {
logrus.WithField("values", kv).Debug("Setting annotation")
logrus.WithField("values", kv).Info("Setting annotation")
l.gsMutex.Lock()
defer l.gsMutex.Unlock()

Expand All @@ -289,7 +289,7 @@ func (l *LocalSDKServer) SetAnnotation(_ context.Context, kv *sdk.KeyValue) (*sd

// GetGameServer returns current GameServer configuration.
func (l *LocalSDKServer) GetGameServer(context.Context, *sdk.Empty) (*sdk.GameServer, error) {
logrus.Debug("Getting GameServer details")
logrus.Info("Getting GameServer details")
l.recordRequest("gameserver")
l.gsMutex.RLock()
defer l.gsMutex.RUnlock()
Expand All @@ -298,7 +298,7 @@ func (l *LocalSDKServer) GetGameServer(context.Context, *sdk.Empty) (*sdk.GameSe

// WatchGameServer will return current GameServer configuration, 3 times, every 5 seconds
func (l *LocalSDKServer) WatchGameServer(_ *sdk.Empty, stream sdk.SDK_WatchGameServerServer) error {
logrus.Debug("Connected to watch GameServer...")
logrus.Info("Connected to watch GameServer...")
observer := make(chan struct{})

defer func() {
Expand All @@ -323,7 +323,7 @@ func (l *LocalSDKServer) WatchGameServer(_ *sdk.Empty, stream sdk.SDK_WatchGameS

// Reserve moves this GameServer to the Reserved state for the Duration specified
func (l *LocalSDKServer) Reserve(ctx context.Context, d *sdk.Duration) (*sdk.Empty, error) {
logrus.WithField("duration", d).Debug("Reserve request has been received!")
logrus.WithField("duration", d).Info("Reserve request has been received!")
l.recordRequest("reserve")
l.gsMutex.Lock()
defer l.gsMutex.Unlock()
Expand Down Expand Up @@ -426,18 +426,18 @@ func EqualSets(a, b []string) bool {

// Close tears down all the things
func (l *LocalSDKServer) compare() {
logrus.Debug("Compare")
logrus.Info("Compare")

if l.testMode {
if !EqualSets(l.expectedSequence, l.requestSequence) {
logrus.Debug(fmt.Sprintf("Testing Failed %v %v", l.expectedSequence, l.requestSequence))
logrus.Info(fmt.Sprintf("Testing Failed %v %v", l.expectedSequence, l.requestSequence))
os.Exit(1)
}
}
}

func (l *LocalSDKServer) setGameServerFromFilePath(filePath string) error {
logrus.WithField("filePath", filePath).Debug("Reading GameServer configuration")
logrus.WithField("filePath", filePath).Info("Reading GameServer configuration")

reader, err := os.Open(filePath) // nolint: gosec
defer reader.Close() // nolint: megacheck,errcheck
Expand Down