Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't send empty aggregated metric payloads #15756

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 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 @@ -219,6 +222,10 @@ func (p *Push) buildPayload(ctx context.Context) ([]byte, error) {
}
}

if len(streams) == 0 {
return nil, nil
}

req := &logproto.PushRequest{
Streams: streams,
}
Expand Down Expand Up @@ -268,6 +275,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
Loading