Module: Datadog::Profiling::NativeExtensionHelpers::Supported
- Defined in:
- ext/datadog_profiling_native_extension/native_extension_helpers.rb
Overview
Used to check if profiler is supported, including user-visible clear messages explaining why their system may not be supported.
Constant Summary collapse
- CONTACT_SUPPORT =
[ "For help solving this issue, please contact Datadog support at", "<https://docs.datadoghq.com/help/>.", "You can also check out the Continuous Profiler troubleshooting page at", "<https://dtdg.co/ruby-profiler-troubleshooting>.", ].freeze
- GET_IN_TOUCH =
[ "Get in touch with us if you're interested in profiling your app!", ].freeze
- UPGRADE_RUBY =
[ "Upgrade to a modern Ruby to enable profiling for your app.", ].freeze
- FAILED_TO_CONFIGURE_LIBDATADOG =
Validation for this check is done in extconf.rb because it relies on mkmf
explain_issue( "there was a problem in setting up the `libdatadog` dependency.", suggested: CONTACT_SUPPORT, )
- COMPILER_ATOMIC_MISSING =
Validation for this check is done in extconf.rb because it relies on mkmf
explain_issue( "your C compiler is missing support for the <stdatomic.h> header.", "This issue can usually be fixed by upgrading to a later version of your", "operating system image or compiler.", suggested: CONTACT_SUPPORT, )
Class Method Summary collapse
-
.failure_banner_for(reason:, suggested:, fail_install:) ⇒ Object
This banner will show up in the logs/terminal while compiling the native extension.
-
.render_skipped_reason_file(reason:, suggested:) ⇒ Object
This will be saved in a file to later be presented while operating the gem.
- .supported? ⇒ Boolean
- .unsupported_reason ⇒ Object
Class Method Details
.failure_banner_for(reason:, suggested:, fail_install:) ⇒ Object
This banner will show up in the logs/terminal while compiling the native extension
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'ext/datadog_profiling_native_extension/native_extension_helpers.rb', line 40 def self.(reason:, suggested:, fail_install:) prettify_lines = proc { |lines| Array(lines).map { |line| "| #{line.ljust(76)} |" }.join("\n") } outcome = if fail_install [ "Failing installation immediately because the ", "`#{ENV_FAIL_INSTALL_IF_MISSING_EXTENSION}` environment variable is set", "to `true`.", "When contacting support, please include the <mkmf.log> file that is shown ", "below.", ] else [ "The Datadog Continuous Profiler will not be available,", "but all other datadog features will work fine!", ] end %( +------------------------------------------------------------------------------+ | Could not compile the Datadog Continuous Profiler because | #{prettify_lines.call(reason)} | | #{prettify_lines.call(outcome)} | | #{prettify_lines.call(suggested)} +------------------------------------------------------------------------------+ ) end |
.render_skipped_reason_file(reason:, suggested:) ⇒ Object
This will be saved in a file to later be presented while operating the gem
71 72 73 |
# File 'ext/datadog_profiling_native_extension/native_extension_helpers.rb', line 71 def self.render_skipped_reason_file(reason:, suggested:) [*reason, *suggested].join(" ") end |
.supported? ⇒ Boolean
23 24 25 |
# File 'ext/datadog_profiling_native_extension/native_extension_helpers.rb', line 23 def self.supported? unsupported_reason.nil? end |
.unsupported_reason ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'ext/datadog_profiling_native_extension/native_extension_helpers.rb', line 27 def self.unsupported_reason disabled_via_env? || on_jruby? || on_truffleruby? || on_windows? || on_macos? || on_unknown_os? || on_unsupported_cpu_arch? || libdatadog_not_available? || libdatadog_not_usable? end |