-
Notifications
You must be signed in to change notification settings - Fork 10
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
[PROF-8917] Add Ruby helper to get ld_library_path
for libdatadog
#423
Conversation
**What does this PR do?** This PR adds a `Libdatadog.ld_library_path` helper to the libdatadog Ruby support code. This helper returns the full path to the `lib/` folder where the libdatadog `.so` files are contained. **Motivation:** I'm adding this to support the crashtracker for Ruby: we need this information when starting the crashtracker, and rather than having the knowledge of folder layouts inside dd-trace-rb, I think it makes sense for the libdatadog Ruby code to keep this knowledge. **Additional Notes:** I'm planning to include this change in the libdatadog 9 release for Ruby. **How to test the change?** Test coverage is included (and CI runs these tests).
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #423 +/- ##
=======================================
Coverage 65.36% 65.36%
=======================================
Files 184 184
Lines 22503 22503
=======================================
Hits 14710 14710
Misses 7793 7793
|
This will be integrated into the libdatadog v9 release in DataDog/libdatadog#423 .
|
||
return unless pkgconfig_folder | ||
|
||
File.absolute_path("#{pkgconfig_folder}/../") |
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.
I trust you know what you are doing... 😉
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.
Ahaha thanks! To be clear, what this does is take the structure of our binary builds:
% tree
.
├── bin
│ └── libdatadog-crashtracking-receiver
├── cmake
│ └── DatadogConfig.cmake
├── include
│ └── datadog
│ ├── blazesym.h
│ ├── common.h
│ ├── profiling.h
│ └── telemetry.h
├── lib
│ ├── libdatadog_profiling.a
│ ├── libdatadog_profiling.so
│ ├── libdatadog_profiling.so.debug
│ └── pkgconfig
│ ├── datadog_profiling.pc
│ ├── datadog_profiling-static.pc
│ └── datadog_profiling_with_rpath.pc
├── LICENSE
├── LICENSE-3rdparty.yml
└── NOTICE
and encodes the knowledge that the .so file is in the parent folder to the pkgconfig file.
I could've implemented this another way (e.g. search for the so file directly or something), but since this is internal to the libdatadog helper, and we already have another helper that does this relative find thing, I just went with it.
(Since on the Ruby library side we only call these methods and don't encode any assumptions on the folder structure, we can always update the helpers and move stuff around whenever we want to).
What does this PR do?
This PR adds a
Libdatadog.ld_library_path
helper to the libdatadog Ruby support code.This helper returns the full path to the
lib/
folder where the libdatadog.so
files are contained.Motivation
I'm adding this to support the crashtracker for Ruby: we need this information when starting the crashtracker, and rather than having the knowledge of folder layouts inside dd-trace-rb, I think it makes sense for the libdatadog Ruby code to keep this knowledge.
Additional Notes
I'm planning to include this change in the libdatadog 9 release for Ruby.
How to test the change?
Test coverage is included (and CI runs these tests).