-
Notifications
You must be signed in to change notification settings - Fork 375
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
Lazily activate integrations #1037
Conversation
Rails minitests don't like these changes for some reason, still haven't figured it out. Once CI is green this will be ready for review. |
5a297e3
to
7327e16
Compare
7327e16
to
81e1aa3
Compare
81e1aa3
to
17e1e38
Compare
Figured out why the Rails tests were failing. When Rails is configured with Prior to this PR, the In this PR after we switched to lazy patching, This is not the only reason we have to The unfortunate side effect is that for Rails applications, the tracer components are effectively initialized twice; once after Despite this, I think we do have a reasonable solution in place, and while it isn't perfect, it stands to grant benefits that justify any imperfections we've seen and considered thus far. |
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.
👍
@delner Something might be strange in my configuration but this change has the unfortunate side-effect of creating 2 instances of ObjectSpace.each_object(Datadog::Tracer).count #=> 2 One of these is accessible by calling |
Today, in a configuration block...
c.use
configures and patches the integration immediately. This has the unwanted side effect of causing trace components being initialized with default settings before the configuration block is completed, because patching integrations often callsDatadog.logger
which is a trace component.In this pull request,
c.use
adds the integration to a list of pending integrations, which are each patched after the configuration block completes and the trace components are initialized. This prevents trace components from being re-initialized multiple times during setup.