File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ Writers can be configured through `spectator.Config.Location`.
184184
185185Possible values are:
186186
187- * ` "" ` - Empty string will default to ` udp ` .
187+ * ` "" ` - Empty string will default to ` udp ` , with the ` LineBuffer ` disabled by default .
188188* ` none ` - A no-op writer that does nothing. Used to disable metrics collection.
189189* ` memory ` - Write to memory. Useful for testing.
190190* ` stderr ` - Write to standard error for the process.
@@ -200,6 +200,17 @@ the environment variable takes precedence over the passed config.
200200
201201The environment variable ` SPECTATOR_OUTPUT_LOCATION ` can be set to ` none ` to disable metrics collection.
202202
203+ ## Line Buffer
204+
205+ The ` NewConfigWithBuffer ` factory function takes a ` bufferSize ` parameter that configures an optional
206+ ` LineBuffer ` , which caches protocol lines locally, before flushing them to ` spectatord ` . Flushes occur
207+ under two conditions: (1) the buffer size is exceeded, or (2) five seconds has elapsed. The buffer is
208+ available for the ` UdpWriter ` and the ` UnixgramWriter ` , where performance matters most. The ` LineBuffer `
209+ is disabled by default (with size zero) in the standard ` NewConfig ` factory function, to ensure that the
210+ default operation of the library works under most circumstances. For high-performance scenarios, a 60KB
211+ buffer size is recommended. The maximum buffer size for udp sockets and unix domain sockets on Linux is
212+ 64KB, so stay under this limit.
213+
203214## Batch Usage
204215
205216When using ` spectator-go ` to report metrics from a batch job, ensure that the batch job runs for at
You can’t perform that action at this time.
0 commit comments