-
Notifications
You must be signed in to change notification settings - Fork 807
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
fix(exporter-collector): all http export requests should share same a… #1863
fix(exporter-collector): all http export requests should share same a… #1863
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1863 +/- ##
==========================================
- Coverage 92.68% 92.66% -0.02%
==========================================
Files 174 174
Lines 6040 6040
Branches 1284 1284
==========================================
- Hits 5598 5597 -1
- Misses 442 443 +1
|
The lint fail is not related to my PR:
|
packages/opentelemetry-exporter-collector/src/platform/node/util.ts
Outdated
Show resolved
Hide resolved
@naseemkullah it should not be merged yet -> please read https://github.com/open-telemetry/opentelemetry-js/blob/master/CONTRIBUTING.md#general-merge-requirements |
Oops, sorry @obecny, another maintainer approval was required. |
it is also a breaking change so I would expect 24 hours wait so more people can have a chance to look at. |
why is it a breaking change? |
You have removed public |
@naseemkullah please when merging ensure one of the changelog labels from lerna.json is applied |
Thanks @dyladan, will do! |
Additionally, merge requirements were not met for this PR. Merge by a non-maintainer requires at least 2 maintainer approvals. This PR only has 1. I am not going to revert but please keep this in mind in the future. |
@dyladan yes true, this was pointed out by @obecny and acked: #1863 (comment) :) |
@blumamir since this is a breaking change can you please document the break in the migration section of the README in another PR? |
sure, I'll send this PR tomorrow. |
I guess it will be enough to mention what has been removed. |
The beforeEach() hook was not awaited, so afterEach() could run before it completed, resulting in a client.disconnect() that rejects, and a mocha hook that calls done() twice. Refs: open-telemetry#1860 Co-authored-by: Marc Pichler <[email protected]>
Which problem is this PR solving?
Currently, each new HTTP request in exporter collector is
new
ing a new agent, which means different requests do not share connection pool, and that each one is creating a brand new socket with tcp handshake and TLS handshake.Short description of the changes
Create a single http/https agent in exporter constructor and set the same one in the options for each HTTP request.
As I wrote in the issue, In my opinion it's better to pass an initialized agent to the collector instead of the collector creating one for itself. Since there was no discussion about it, I implemented the fix to stay as close as possible to the current implementation:
httpAgentOptions
option.httpAgentOptions
is used, if user setkeepAlive: false
, a warning will be printed to log and agent will not be used (node's agent allow this configuration, why do we prevent it in the exporter?)I added a unittest for the change, and tested it locally in a real application, and observed the latency of a single export after warmup. My test application is located in Israel and export spans to collector in aws Ireland. Export time dropped from ~500ms prior to the fix, to ~100ms with the fix.