-
Notifications
You must be signed in to change notification settings - Fork 806
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(@opentelemetry/exporter-collector): remove fulfilled promises cor… #1775
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1775 +/- ##
==========================================
- Coverage 92.66% 92.14% -0.52%
==========================================
Files 137 120 -17
Lines 4973 3998 -975
Branches 1047 844 -203
==========================================
- Hits 4608 3684 -924
+ Misses 365 314 -51 |
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.
it looks good, just wondering one thing here, if onSuccess
or onError
for any reason will raise an error the resolve
will never be called and the promise will stay there forever. What if you resolve the promise first and then call the callback so it will never be a problem ?
@obecny I don't think I've changed that behavior in this PR, but I am happy to modify. If onSuccess/onError raise an error, then the promise would reject right? Then, would moving the splice to a |
I know you haven't changed that, but just analyzing all edge cases and this is the last thing that might produce such behaviour with not removing the promise probably very rare but still. With regards to |
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, could you fix the test ? thanks
@vmarchaud any idea what the issue is? It only fails on node8, I think it is something node8 specific. |
packages/opentelemetry-exporter-collector-grpc/src/CollectorExporterNodeBase.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-exporter-collector-proto/src/CollectorExporterNodeBase.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-exporter-collector/src/platform/browser/CollectorExporterBrowserBase.ts
Outdated
Show resolved
Hide resolved
packages/opentelemetry-exporter-collector/src/platform/node/CollectorExporterNodeBase.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
Overall LGTM but the tests are still failing |
Please fix the tests and the conflict |
Sorry for the slow progress here. I didn't realize |
packages/opentelemetry-exporter-collector-grpc/test/CollectorExporterNodeBase.test.ts
Show resolved
Hide resolved
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
Which problem is this PR solving?
Fixes #1774 and fixes the issue in several other places
Short description of the changes
Move the
_onFinish()
callback code, which pops the resolved promises off the queue, to a separatethen()
where a reference topromise
is available.One strange thing here is that the popping code will not run at shutdown with
Promise.all(this._sendingPromises)
because it is not the same promise pushed in the queue. I think this should be ok though?