Skip to content

Commit 11307e9

Browse files
committed
fix cns zap logger issue
1 parent 69ed25a commit 11307e9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

cns/logger/cnslogger.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ func New(fileName string, logLevel, logTarget int, logDir string) (loggershim, e
4545
if err != nil {
4646
l.Errorf("Failed to get zap Platform cores: %v", err)
4747
}
48-
zapLogger := zap.New(platformCore, zap.AddCaller()).With(zap.Int("pid", os.Getpid()))
48+
49+
zapLogger := zap.New(
50+
platformCore,
51+
zap.AddCaller(),
52+
zap.AddStacktrace(zapcore.WarnLevel),
53+
).With(zap.Int("pid", os.Getpid()))
4954

5055
return &logger{
5156
logger: l,

cns/restserver/metrics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func (a *asyncMetricsRecorder) record() {
219219
func (service *HTTPRestService) publishIPStateMetrics() {
220220
recorder.once.Do(func() {
221221
recorder.podIPConfigSrc = service.PodIPConfigStates
222-
recorder.sig = make(chan struct{})
222+
recorder.sig = make(chan struct{}, 1)
223223
go recorder.run()
224224
})
225225
select {

0 commit comments

Comments
 (0)