Skip to content
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

bluebird, promise, q #15

Open
obecny opened this issue Jan 7, 2020 · 7 comments
Open

bluebird, promise, q #15

obecny opened this issue Jan 7, 2020 · 7 comments

Comments

@obecny
Copy link
Member

obecny commented Jan 7, 2020

Make sure those 3 libraries for promises

  • bluebird 10,5mln downloads/week
  • promise 4.8mln downloads/week
  • q 4,7mln downloads/week

works fine with context propagation for scope managers on web and node
If not then add support for them.
Unless someone can already answer these precisely, otherwise this can be a spike to see what needs to be done.

@obecny obecny self-assigned this Jan 7, 2020
@obecny
Copy link
Member Author

obecny commented Jan 8, 2020

so far

  1. browser:
  • bluebird works fine with zone
  • q doesn't work with zone
  • promise doesn't work with zone

@draffensperger
Copy link
Contributor

I'm curious if it's possible to figure out whether the Zone.js library gets loaded before the promise library and whether that makes any difference. My understanding is that Zone.js works by monkey-patching the core browser APIs and so that as long as its loaded first it should ideally work with any kinds of wrappers / polyfills around those APIs. Though if it's loaded second it may not work if the library grabs its own copy of some native APIs before Zone can monkey-patch them.

I could be wrong on this understanding, but at least worth looking into.

@obecny
Copy link
Member Author

obecny commented Jan 14, 2020

FYI I'm finishing already the 2 new plugins for q and for promise.

@draffensperger
Copy link
Contributor

OK, makes sense. I think it still would be worthwhile to investigate how Zone.js behaves related to the order of NPM package loading, because if Zone being loaded first can solve these problems as well, then we might get more coverage faster.

For example there are also various HTTP request wrapper packages that would probably have similar behaviors. As part of our work on OpenCensus Web, we found that the XHR monkey-patching that Zone does (and that our library does) needed to be done first before use of an HTTP library - axios I think in our case of some early example testing.

It isn't super normal to have one library come "first" especially in things like webpack builds, etc. but I think figuring out how to do that would be really powerful. There may be some config settings you can apply in the bundlers to make it happen that we could document for people

@vmarchaud
Copy link
Member

Moving over the contrib repo

@vmarchaud vmarchaud transferred this issue from open-telemetry/opentelemetry-js Apr 25, 2020
@rauno56
Copy link
Member

rauno56 commented Apr 14, 2021

Bluebird added support for async_hooks in v3.6.0 Oct. 2019 for context prop in Node.js. See: petkaantonov/bluebird#1472

Whether that's enough and works, I don't currently know.

EDIT

... but planning to find out.

@rauno56
Copy link
Member

rauno56 commented Apr 19, 2021

It seems to me, that the context is propagated fine through bluebird promises and promise array chains. Is there a specific example I should test for those promise libs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants