-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New plugin hooks around fetching gems and git sources #8162
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
base: master
Are you sure you want to change the base?
Conversation
|
Thanks for opening a pull request and helping make RubyGems and Bundler better! Someone from the RubyGems team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality. We use GitHub Actions to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of GitHub Actions in the PR status window below. If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #rubygems or #bundler channel on Slack. For more information about contributing to the RubyGems project feel free to review our CONTRIBUTING guide |
c402f3b to
6392a2b
Compare
|
This is very cool! A timing profiler gem sounds extremely useful. Thanks for building that, and for proposing these hooks. Do you think it still makes sense to still fire the hooks even if the gem has no remote and cannot be fetched, and so the interior is just a no-op? |
6392a2b to
11fcf0d
Compare
|
Hi @indirect - took me a while to get back to this. Since then:
Its likely I don't fully grok the details of git based fetches yet, so might be missing something. Can you clarify your earlier question
What is an example of a git source gem without a remote? 🤔 |
|
Very cool, nice work. My question was about regular gems with no remote source, like |
|
This seems related to #3305, and #7622. I think install time should be provided by Bundler by default, at least in verbose mode. Can you imagine other use cases for these hooks? Overall I'm not too convinced about adding more hooks right now because I feel we should focus on improving our plugin system first, so it gets more appealing (hopefully I can resume work on #6957 soon). For example, we recently added #3439 but I have not heard of any actual real usage yet. Besides I'm not sure these hooks will be truly representative of "network time". When I've seen Bundler getting slow due to network operations, it's been usually when downloading the compact index, and I think that's not captured by these hooks. On the other hand, download time between individual gems is usually very similar and if it's slow it's usually an overall problem not caused by the size of a particular gem. |
What was the end-user or developer problem that led to this PR?
During bundler install runs, most prominently as part of a CI / container building pipeline, I was wondering which of our (many) gems where having the most impact on runtime. For a larger-ish project with some hundred+ gems a typical bundler install run can take multiple minutes. As of right now, there was no good way (that we knew of) to dissect which individual gems take the majority of time.
Native extensions are an obvious culprit and so are network download times.
We've been hacking a small plugin called Bundler-Timing, which gives per-gem install timing statistics. However this approach was lacking more detailed events to determine:
What is your fix for the problem, implemented in this PR?
Introduce two new sets of plugin events:
GEM_BEFORE_FETCHandGEM_AFTER_FETCHGIT_BEFORE_FETCHandGIT_AFTER_FETCHPlease feel free to see the above mentioned plugin for an example implementing the hooks.
If introducing new hooks is generally acceptable for this project and there is no concerns moving forward, I'll add some specs as well. Right now I'm happy with interactively experimenting using our timing plugin.
Make sure the following tasks are checked