work on flags

This commit is contained in:
2022-11-11 17:09:12 +02:00
parent 2ded62f641
commit 0b3d382742
7 changed files with 67 additions and 67 deletions

View File

@@ -5,10 +5,11 @@ import (
"log"
"sync"
"git.k-space.ee/k-space/logmower-shipper/pkg/globals"
m "git.k-space.ee/k-space/logmower-shipper/pkg/mongo"
)
var BufferLimitBytes int
type (
RawC <-chan Raw
Raw struct {
@@ -87,9 +88,9 @@ func (lines singleLines) process(ctx context.Context, parsed chan<- m.Record) {
buffer = append(buffer, line.B...)
if len(buffer) > globals.BufferLimitBytes {
if len(buffer) > BufferLimitBytes && BufferLimitBytes != 0 {
promRecordDroppedTooLarge.WithLabelValues(line.MetricsName).Add(1)
log.Printf("dropped record: size in bytes exceeds limit of %d", globals.BufferLimitBytes)
log.Printf("dropped record: size in bytes exceeds limit of %d", BufferLimitBytes)
buffer = nil
continue