-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
require parent Tracing module before defining children #5190
Conversation
^ Obviously tests are failing there — will address shortly. It's also throwing warnings about the circular requires, though I'm not sure there's a way to avoid that given the current structure. |
Hey, thanks for the detailed report and this suggested fix. The same kind of problem popped up here: #5188 I'm open to supporting these single-file requires, but do you mind sharing why it's important? For example, what if you remove that I'm open to supported these nested requires, but I'd like to understand a little more about why they're necessary. (I'd expect |
Well we have a library that requires I'm not really sure of the utility of using autoloading here in the first place — as the readme correctly points out, this isn't recommended in production, so is this just a development/test mode optimization? FWIW I would happily trade the 160ms saved for more predictable loading behavior. |
Yeah, that's fair -- if it's code that's already out there, then let's make it work again. To clarify, do you need all these traces, or just ActiveSupportNotificationsTrace? |
… making each other pass
To avoid the circular reference, I updated them all to |
I think the underlying issue is probably still the same — the file I used in my example already requires platform_trace. |
Oh, I see -- my test wasn't enough because it didn't |
I slathered on some more |
(Continuing discussion from #5178)
We've had a report that this change breaks constant loading if any of the nested files are required during app boot (I can open a new issue on this if necessary).
Here's a minimal reproduction:
What I think is happening is that the nested graphql/tracing/**.rb files don't require their parent (tracing.rb). So requiring this file:
NameError: uninitialized constant GraphQL::Tracing::AppOpticsTrace::PlatformTrace
I believe all of these nested files should include a top-level require 'graphql/tracing' to ensure the order is correct.