Skip to content

Commit

Permalink
fix: don't send empty aggregated metric payloads
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorwhitney committed Jan 14, 2025
1 parent 8e260fe commit c5bd2ad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/pattern/aggregation/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit c5bd2ad

Please sign in to comment.