-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(exporter-collector): implement concurrencyLimit option #1708
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1708 +/- ##
=======================================
Coverage 91.91% 91.92%
=======================================
Files 167 167
Lines 5567 5573 +6
Branches 1183 1186 +3
=======================================
+ Hits 5117 5123 +6
Misses 450 450
|
b8a1e08
to
04b05b0
Compare
Note: I considered setting some non-infinite default value for concurrentLimit but left it as it is now to avoid changing the behavior of the library. |
I don't know why it thinks the changes are not covered by the unit tests, they seem to be covered to my eye. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation itself LGTM but @obecny wrote most of this code so I'm going to defer to him as to if this is a good idea we should merge or not.
packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts
Outdated
Show resolved
Hide resolved
5c8719f
to
742a228
Compare
This adds an option to the collector exporters `concurrencyLimit`. If this is set and the number of export operations is equal to the limit, additional export operations will fail immediately. This should be set in combination with the batch span processor be set such that the concurrency limit would not be reached under "normal" circumstances - only if there is an issue would spans start to be dropped. This helps us cap the amount of memory & sockets used by the exporter if it is not able to keep up with the data it is being provided. This could happen if the local network (e.g. in a browser) or the remote collector are too slow to handle all the activity. If we do not have this cap, and the exporter cannot keep up, resources such as memory and network sockets can be consumed without limit, causing crashes and other undesirable outcomes far worse than losing some telemetry data. This also updates the examples to use `BatchSpanProcessor` as I couldn't really think of any reason why you would want to use SimpleSpanProcessor in combination with the collector exporter.
@dobesv pls do not force push after 1st review is done, it is impossible to see changes then |
742a228
to
279c2d9
Compare
@obecny Thanks for the review. I have pushed changes that I hope addressed your comments. Let me know if there's anything more I can do to help. |
@obecny Ah sorry about the force push, it's a habit from other places that want a single commit. |
We squash it when we merge anyways. No need to worry about it during the PR process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This adds an option to the collector exporters
concurrencyLimit
. If this is set andthe number of export operations is equal to the limit, additional export operations
will fail immediately.
This should be set in combination with the batch span processor be set such that the
concurrency limit would not be reached under "normal" circumstances - only if there
is an issue would spans start to be dropped.
This helps us cap the amount of memory & sockets used by the exporter if it is not
able to keep up with the data it is being provided.
This could happen if the local network (e.g. in a browser) or the remote collector
are too slow to handle all the activity.
If we do not have this cap, and the exporter cannot keep up, resources such as
memory and network sockets can be consumed without limit, causing crashes and
other undesirable outcomes far worse than losing some telemetry data.
This also updates the examples to use
BatchSpanProcessor
as I couldn't reallythink of any reason why you would want to use SimpleSpanProcessor in combination
with the collector exporter.
Fixes #1707