Capability to enable/disable loggerSampler in the exporterHelper #8125
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue:
In one of the use cases which we are working on, we have identified that
sampledLogger
mechanism used in the Opentelemetry exporters (otlpexporter
andotlphttpexporter
), could become a memory bottleneck, when the number of exports in the same pipeline is high (we are talking about 100s of instances of exporters running on the same machine).The sampledLogger is created inside the exporterhelper module and the sampling is always activated unless the collector is in debug mode:
Investigation:
The high memory usage has been discovered using https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/pprofextension
In the first scenario, default configuration with the
sampledLogger
active, based on the profiled data we could observe that sampling mechanism was responsible for allocating aprox. 75% of the memory of the running collector:In the second scenario, with the same number of running exporters, but with the
sampledLogger
mechanism disabled (usingdebug
level configuration check configuration below), we were able to observe a much smaller memory footprint:Given that the logging sampling mechanism could become a bottleneck in certain scenarios (our case), we would like to propose a contribution, which potentially can improve the memory footprint of the exporters in certain use cases (potentially making it more scalable)
Proposal:
Add a new configuration
SampledLoggerSetting
to theotlpexporter
andotlphttpexporter
Default configuration:
Documentation:
Update Readme of
otlpexporter
andotlphttpexporter
with the new configuration fieldSampledLoggerSettings