Skip to content

Commit

Permalink
Add line length to batchSize (#108)
Browse files Browse the repository at this point in the history
* Add line length to batchSize

Signed-off-by: Eugen Biegler <nupagadi@posteo.de>

* Reset batchSize in timer condition too

Signed-off-by: Eugen Biegler <nupagadi@posteo.de>
  • Loading branch information
negbie authored and tomwilkie committed Dec 14, 2018
1 parent 86fbdc0 commit 1d87a22
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/promtail/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ func (c *Client) run() {
if err := c.send(batch); err != nil {
level.Error(c.logger).Log("msg", "error sending batch", "error", err)
}
batchSize = 0
batch = map[model.Fingerprint]*logproto.Stream{}
}

batchSize += len(e.Line)
fp := e.labels.FastFingerprint()
stream, ok := batch[fp]
if !ok {
Expand All @@ -126,6 +128,7 @@ func (c *Client) run() {
if err := c.send(batch); err != nil {
level.Error(c.logger).Log("msg", "error sending batch", "error", err)
}
batchSize = 0
batch = map[model.Fingerprint]*logproto.Stream{}
}
}
Expand Down

0 comments on commit 1d87a22

Please sign in to comment.