Add experimental toggle to disable the profiling native extension #1594
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.
In #1584 I identified that users of dd-trace-rb on Linux/macOS needed to have a working build environment to compile msgpack and ffi, and so installing our gem would be no different.
I've since identified a possible corner case: in the reliability environment, we use the GitLab omnibus distribution
(https://docs.gitlab.com/omnibus/), which already ships pre-compiled versions of msgpack and ffi, but does not include a compiler nor the Ruby headers required for compiling extensions.
Thus, up until now it was trivial to add dd-trace-rb (and profiling) to these images, but the addition of the native extension complicates things a lot.
Since the native extension is still in the "we're evaluating and learning about the downsides/sharp edges of having it" phase, I decided to add a
DD_PROFILING_NO_EXTENSION
environment variable, that for now can be used to disable building and usage of the extension.Because the extension is currently empty, doing this is is harmless, but in the future, the use of
DD_PROFILING_NO_EXTENSION
will lead to the profiler being disabled as well, once the profiler code starts requiring the native extension to be available. For that reason, I documented this toggle as experimental, and added a warning whenever the app is loaded with it.For users reading this (if any!): if you needed to use this option, please tell us why on
https://github.com/DataDog/dd-trace-rb/issues/new as we want to accommodate your use cases.