[PROF-11809] Allow overriding headers folder using env var#16
Merged
Conversation
**What does this PR do?** This PR adds the ability to override the folder used for reading the headers from using an environment variable: `DATADOG_RUBY_HEADERS_OVERRIDE`. This way, when building the `datadog` gem, we can point directly at any Ruby source tree and use the headers in it. **Motivation:** We have an existing similar mechanism in libdatadog (https://github.com/DataDog/libdatadog/blob/91c0d493f5b62bde6c5f1971e7814f2478b63bf1/ruby/lib/libdatadog.rb#L24) which comes in really handy when we want to quickly test out some change without having to hack the gem or copying over files. I was using it today to test against latest ruby-head, without having to import those headers explicitly first. **Additional Notes:** N/A **How to test the change?** This can be easily tested by building the profiler (e.g. `bundle exec rake clean compile`) in the dd-trace-rb repo. Here's how it looks without this override on Ruby master: ``` ************************************************************************** No source for ruby-3.5.0 (revision a0fe0095ab2711ba54b29cdd2a5957f993cfc1de) provided with datadog-ruby_core_source gem. Falling back to ruby-3.5.0-preview1. ************************************************************************** Using datadog-ruby_core_source headers from datadog-ruby_core_source/lib/datadog/ruby_core_source/ruby-3.5.0-preview1 ``` and with the override: ``` Using datadog-ruby_core_source headers from .rvm/src/ruby-head ```
AlexJF
approved these changes
May 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR adds the ability to override the folder used for reading the headers from using an environment variable:
DATADOG_RUBY_HEADERS_OVERRIDE.This way, when building the
datadoggem, we can point directly at any Ruby source tree and use the headers in it.Motivation:
We have an existing similar mechanism in libdatadog (https://github.com/DataDog/libdatadog/blob/91c0d493f5b62bde6c5f1971e7814f2478b63bf1/ruby/lib/libdatadog.rb#L24) which comes in really handy when we want to quickly test out some change without having to hack the gem or copying over files.
I was using it today to test against latest ruby-head, without having to import those headers explicitly first.
Additional Notes:
N/A
How to test the change?
This can be easily tested by building the profiler (e.g.
bundle exec rake clean compile) in the dd-trace-rb repo.Here's how it looks without this override on Ruby master:
and with the override: