diff --git a/pkg/pattern/aggregation/push.go b/pkg/pattern/aggregation/push.go index 7b7a7777ab28b..f2b71761f399f 100644 --- a/pkg/pattern/aggregation/push.go +++ b/pkg/pattern/aggregation/push.go @@ -177,6 +177,9 @@ func (p *Push) buildPayload(ctx context.Context) ([]byte, error) { defer sp.Finish() entries := p.entries.reset() + if len(entries) == 0 { + return nil, nil + } entriesByStream := make(map[string][]logproto.Entry) for _, e := range entries { @@ -268,6 +271,10 @@ func (p *Push) run(pushPeriod time.Duration) { continue } + if len(payload) == 0 { + continue + } + // We will use a timeout within each attempt to send backoff := backoff.New(context.Background(), *p.backoff)