Skip to content

Commit ee9065f

Browse files
authored
remove unnecessary debug level logging for autoscaler event (#1453)
What changed? Emit metrics logging happens every "cooldown time" (10s by default) and thus created a ton of debug logging. These logging are not needed. Why? Some user complains about too much debug level logging How did you test it? unit test
1 parent 942ec49 commit ee9065f

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

internal/worker/concurrency_auto_scaler.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,13 @@ func (c *ConcurrencyAutoScaler) logEvent(event autoScalerEvent) {
216216
}
217217
c.scope.Histogram(metricsPollerQuota, metricsPollerQuotaBuckets).RecordValue(float64(c.concurrency.PollerPermit.Quota()))
218218
c.scope.Histogram(metricsPollerWaitTime, metricsPollerWaitTimeBuckets).RecordDuration(c.pollerWaitTime.Average())
219-
c.log.Debug(autoScalerEventLogMsg,
220-
zap.String("event", string(event)),
221-
zap.Bool("enabled", c.enabled),
222-
zap.Int("poller_quota", c.concurrency.PollerPermit.Quota()),
223-
)
219+
if event != autoScalerEventEmitMetrics {
220+
c.log.Debug(autoScalerEventLogMsg,
221+
zap.String("event", string(event)),
222+
zap.Bool("enabled", c.enabled),
223+
zap.Int("poller_quota", c.concurrency.PollerPermit.Quota()),
224+
)
225+
}
224226
}
225227

226228
func (c *ConcurrencyAutoScaler) updatePollerPermit() {

internal/worker/concurrency_auto_scaler_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -301,15 +301,13 @@ func TestConcurrencyAutoScaler(t *testing.T) {
301301

302302
var actualEvents []eventLog
303303
for _, event := range obs.FilterMessage(autoScalerEventLogMsg).All() {
304-
if event.ContextMap()["event"] != string(autoScalerEventEmitMetrics) {
305-
t.Log("event: ", event.ContextMap())
304+
t.Log("event: ", event.ContextMap())
306305

307-
actualEvents = append(actualEvents, eventLog{
308-
eventType: autoScalerEvent(event.ContextMap()["event"].(string)),
309-
enabled: event.ContextMap()["enabled"].(bool),
310-
pollerQuota: event.ContextMap()["poller_quota"].(int64),
311-
})
312-
}
306+
actualEvents = append(actualEvents, eventLog{
307+
eventType: autoScalerEvent(event.ContextMap()["event"].(string)),
308+
enabled: event.ContextMap()["enabled"].(bool),
309+
pollerQuota: event.ContextMap()["poller_quota"].(int64),
310+
})
313311
}
314312
assert.ElementsMatch(t, tt.expectedEvents, actualEvents)
315313
})

0 commit comments

Comments
 (0)