From 9a7c863bd8c40faddc4fc75308c7ec5d43a68bcc Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 5 Oct 2020 15:18:50 +0300 Subject: [PATCH] lib/protoparser/influx: add `-influx.maxLineSize` command-line flag for configuring the maximum size for a single Influx line during parsing Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/807 --- lib/protoparser/influx/streamparser.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/protoparser/influx/streamparser.go b/lib/protoparser/influx/streamparser.go index 5b0fd3287..408d0a344 100644 --- a/lib/protoparser/influx/streamparser.go +++ b/lib/protoparser/influx/streamparser.go @@ -10,12 +10,14 @@ import ( "time" "github.com/VictoriaMetrics/VictoriaMetrics/lib/bytesutil" + "github.com/VictoriaMetrics/VictoriaMetrics/lib/flagutil" "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" "github.com/VictoriaMetrics/VictoriaMetrics/lib/protoparser/common" "github.com/VictoriaMetrics/metrics" ) var ( + maxLineSize = flagutil.NewBytes("influx.maxLineSize", 256*1024, "The maximum size in bytes for a single Influx line during parsing") trimTimestamp = flag.Duration("influxTrimTimestamp", time.Millisecond, "Trim timestamps for Influx line protocol data to this duration. "+ "Minimum practical duration is 1ms. Higher duration (i.e. 1s) may be used for reducing disk space usage for timestamp data") ) @@ -70,7 +72,7 @@ func (ctx *streamContext) Read() bool { if ctx.err != nil { return false } - ctx.reqBuf, ctx.tailBuf, ctx.err = common.ReadLinesBlock(ctx.br, ctx.reqBuf, ctx.tailBuf) + ctx.reqBuf, ctx.tailBuf, ctx.err = common.ReadLinesBlockExt(ctx.br, ctx.reqBuf, ctx.tailBuf, maxLineSize.N) if ctx.err != nil { if ctx.err != io.EOF { readErrors.Inc()