Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
controller: clearer metrics handler shutdown logs
The metrics handler previously always emitted an error when being shut
down, even if the error was nil. This was okay before because we never
actually properly shutdown the metrics handler before, but now that
we're going to, this needs to be clearer.

This makes the metrics handler only emit an error when there is an
error, and emit an info message when it successfully shuts down.
  • Loading branch information
jkyros committed Jun 17, 2022
commit 61a90054ba19564f9242fc882e7da313859ac700
9 changes: 7 additions & 2 deletions pkg/controller/common/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ func StartMetricsListener(addr string, stopCh <-chan struct{}) {
}
}()
<-stopCh
if err := s.Shutdown(context.Background()); err != http.ErrServerClosed {
glog.Errorf("error stopping metrics listener: %v", err)
if err := s.Shutdown(context.Background()); err != nil {
if err != http.ErrServerClosed {
glog.Errorf("error stopping metrics listener: %v", err)
}
} else {
glog.Infof("Metrics listener successfully stopped")
}

}