fix: increment counter when entry be skipped (#17237)

This commit is contained in:
jiuker
2023-05-19 23:36:52 +08:00
committed by GitHub
parent e94e6adf91
commit 41fa8fa2d2

View File

@@ -380,6 +380,8 @@ func (h *Target) Send(ctx context.Context, entry interface{}) error {
default: default:
// Drop messages until we are online. // Drop messages until we are online.
if !h.IsOnline(ctx) { if !h.IsOnline(ctx) {
atomic.AddInt64(&h.totalMessages, 1)
atomic.AddInt64(&h.failedMessages, 1)
return errors.New("log buffer full and remote offline") return errors.New("log buffer full and remote offline")
} }
nWorkers := atomic.LoadInt64(&h.workers) nWorkers := atomic.LoadInt64(&h.workers)