opencensus-java icon indicating copy to clipboard operation
opencensus-java copied to clipboard

configure bufferSize in SpanExporterImpl

Open dmichel1 opened this issue 5 years ago • 2 comments

https://github.com/census-instrumentation/opencensus-java/pull/1893 caps the amount of memory the SpanExporterImpl thread can consume by dropping spans that go past the bufferSize.

However, I can't find a way to configure the bufferSize.

It looks like ExportComponentImpl instantiates SpanExporterImpl with EXPORTER_BUFFER_SIZE = 32; So perhaps somewhere in that code path this can be made configurable.

I'm also a little confused on how to tune the bufferSize. Would be nice to have some examples based on expected spans per second, etc.

It would also be great to add this information around the buffer and memory settings to the documentation.

dmichel1 avatar May 20 '19 13:05 dmichel1

Does having EXPORTER_BUFFER_SIZE = 32 and https://github.com/census-instrumentation/opencensus-java/blob/a95cc72948c142e05163af16c7fbbe0718010058/impl_core/src/main/java/io/opencensus/implcore/trace/export/SpanExporterImpl.java#L261

imply only 128 spans can be buffered at a time by default?

dmichel1 avatar May 21 '19 17:05 dmichel1

Made a change to increase that to 512, so we can do a patch release later today with this fix. Then the other issue to allow users to configure that we will do in the next release.

bogdandrutu avatar May 21 '19 18:05 bogdandrutu