-
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
Namespacing: Profiling #1849
Namespacing: Profiling #1849
Conversation
My feeling is that:
Thoughts @ivoanjo ? |
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.
Looks reasonable. Some extra notes:
- I saw that
./ddtrace/ext/profiling.rb
has not been removed, that looks like an oversight. - Inside the
ext
folder, we also have theddtrace_profiling_native_extension
folder. We probably want to rename that as well; I'd be happy to send a follow-up PR with it (but we can do it at any time, since that name is not a public api) - CI seems to be complaining about a lot of unrelated things; I guess this was branched off of an unstable branch.
Update onboarding documentation with path renaming: https://github.com/DataDog/documentation/blame/eee3812e9a1620455995422bd50b83779b21d537/content/en/tracing/profiler/enabling/ruby.md#L92. Should we keep an alias to ddtrace/profiling/preload for now?
Since we're doing this much cleanup for 1.0, I don't think it quite makes sense to hold on to ddtrace/profiling/preload
as an alias.
BUT, I don't like that customers may run into this error and then have figure out on their own what's up:
[1] pry(main)> require 'ddtrace/profiling/preload'
LoadError: cannot load such file -- ddtrace/profiling/preload
So, rather than an alias, I would suggest leaving the following inside ddtrace/profiling/preload.rb
:
raise LoadError, "this file has been moved. Please update your require to load `datadog/profiling/preload` instead of `ddtrace/profiling/preload`"
Re:
ddtracerb
-->ddprofrb
I would like to keep the current name, for consistency.
- dd-trace-py has a similar tool as well
ddtracerb
comes from the name of the gem vs it being related to tracing
Once we decide to rename the gem, I think it makes sense to deprecate and rename this.
Datadog::Tasks
-->Datadog::Profiling::Tasks
No special feelings, either one seems reasonable.
Overall I agree with all of @ivoanjo 's feedback. Regarding
This is fine. I think we're aligned. |
e7b5269
to
6d00a41
Compare
6d00a41
to
e979f1d
Compare
Codecov Report
@@ Coverage Diff @@
## 1.0 #1849 +/- ##
==========================================
+ Coverage 98.16% 98.22% +0.06%
==========================================
Files 957 959 +2
Lines 47030 47052 +22
==========================================
+ Hits 46168 46219 +51
+ Misses 862 833 -29
Continue to review full report at Codecov.
|
This PR updates the profiler `require` path after changes to `ddtrace`'s namespacing scheme: DataDog/dd-trace-rb#1849 The only namespace change applicable here was that the profiler was moved from `ddtrace/profiling` to `datadog/profiling`.
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.
Seems straightforward to me. I think it's reasonable to merge as-is, if necessary.
Only inquiries I have are:
- Should
Datadog::Profiler
becomeDatadog::Profiling::Profiler
? It's wordy but respects namespaces? How it is now would be fine, just exploring. Whatever we do here,Datadog::Tracer
should match. - Should we hide
Datadog.profiler
? Do users actually directly interact withDatadog.profiler
? I think we should consider this if they don't.
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 👍
- Should we hide Datadog.profiler? Do users actually directly interact with Datadog.profiler? I think we should consider this if they don't.
Yeap, sounds good.
As discussed via chat, I think something like
module Datadog
module Profiling
def self.start_if_enabled
# Getting the profiler instance triggers start as a side-effect;
# otherwise we get nil
!!Datadog.send(:components).profiler
end
end
end
would be more than enough :)
Co-authored-by: Ivo Anjo <[email protected]>
1fb25dd
to
8f6708a
Compare
I've made the changes as suggested. I'm having a hard time with the integration apps failures, but getting there. |
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.
Totally missed this weird bit, but with the fix it LGTM 👍
lib/datadog/profiling.rb
Outdated
def self.start_if_enabled | ||
# Getting the profiler instance triggers start as a side-effect; | ||
# otherwise we get nil | ||
!!Datadog.send(:components).profiler | ||
end |
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.
YAY FOR INTEGRATION TESTS :)
Oops I totally lied to you. 🤦♂️ See if you can spot what I totally forgot AND that the tests were catching because the webserver DID fork.
def self.start_if_enabled | |
# Getting the profiler instance triggers start as a side-effect; | |
# otherwise we get nil | |
!!Datadog.send(:components).profiler | |
end | |
def self.start_if_enabled | |
# If the profiler was not previously touched, getting the profiler instance triggers start as a side-effect | |
# otherwise we get nil | |
profiler = Datadog.send(:components).profiler | |
# ...but we still try to start it BECAUSE if the process forks, the profiler will exist but may | |
# not yet have been started in the fork | |
profiler.start if profiler | |
!!profiler | |
end |
afc4868
to
01aa378
Compare
This PR moves the profiler from
ddtrace/profiling
todatadog/profiling
.The executable
ddtracerb
was left with its original name, as it today represents an executable for the wholeddtrace
gem, despite being used mostly for profiling.The
ddtrace_profiling_native_extension
directory was not renamed: this is a more involved change than a simple renaming, and can be done later as this change will have no user impact.Breaking changes
ddtrace/profiling
todatadog/profiling
.To do after merge