Skip to content

Commit 05f9f4b

Browse files
committed
Clean up
1 parent aa6c59d commit 05f9f4b

File tree

3 files changed

+27
-24
lines changed

3 files changed

+27
-24
lines changed

Rakefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ namespace :test do
6464
command = "bundle check || bundle install && bundle exec rake #{spec_task}"
6565
command += "'[#{spec_arguments}]'" if spec_arguments
6666

67-
total_executors = Datadog::DATADOG_ENV.key?('CIRCLE_NODE_TOTAL') ? Datadog::DATADOG_ENV['CIRCLE_NODE_TOTAL'].to_i : nil
68-
current_executor = Datadog::DATADOG_ENV.key?('CIRCLE_NODE_INDEX') ? Datadog::DATADOG_ENV['CIRCLE_NODE_INDEX'].to_i : nil
67+
total_executors = ENV.key?('CIRCLE_NODE_TOTAL') ? ENV['CIRCLE_NODE_TOTAL'].to_i : nil
68+
current_executor = ENV.key?('CIRCLE_NODE_INDEX') ? ENV['CIRCLE_NODE_INDEX'].to_i : nil
6969

7070
if total_executors && current_executor && total_executors > 1
7171
@execution_count ||= 0
@@ -467,11 +467,11 @@ namespace :coverage do
467467
task :report do
468468
require 'simplecov'
469469

470-
resultset_files = Dir["#{Datadog::DATADOG_ENV.fetch("COVERAGE_DIR", "coverage")}/.resultset.json"] +
471-
Dir["#{Datadog::DATADOG_ENV.fetch("COVERAGE_DIR", "coverage")}/versions/**/.resultset.json"]
470+
resultset_files = Dir["#{ENV.fetch("COVERAGE_DIR", "coverage")}/.resultset.json"] +
471+
Dir["#{ENV.fetch("COVERAGE_DIR", "coverage")}/versions/**/.resultset.json"]
472472

473473
SimpleCov.collate resultset_files do
474-
coverage_dir "#{Datadog::DATADOG_ENV.fetch("COVERAGE_DIR", "coverage")}/report"
474+
coverage_dir "#{ENV.fetch("COVERAGE_DIR", "coverage")}/report"
475475
formatter SimpleCov::Formatter::HTMLFormatter
476476
end
477477
end
@@ -481,11 +481,11 @@ namespace :coverage do
481481
require 'simplecov'
482482
require_relative 'spec/support/simplecov_fix'
483483

484-
versions = Dir["#{Datadog::DATADOG_ENV.fetch("COVERAGE_DIR", "coverage")}/versions/*"].map { |f| File.basename(f) }
484+
versions = Dir["#{ENV.fetch("COVERAGE_DIR", "coverage")}/versions/*"].map { |f| File.basename(f) }
485485
versions.map do |version|
486486
puts "Generating report for: #{version}"
487-
SimpleCov.collate Dir["#{Datadog::DATADOG_ENV.fetch("COVERAGE_DIR", "coverage")}/versions/#{version}/**/.resultset.json"] do
488-
coverage_dir "#{Datadog::DATADOG_ENV.fetch("COVERAGE_DIR", "coverage")}/report/versions/#{version}"
487+
SimpleCov.collate Dir["#{ENV.fetch("COVERAGE_DIR", "coverage")}/versions/#{version}/**/.resultset.json"] do
488+
coverage_dir "#{ENV.fetch("COVERAGE_DIR", "coverage")}/report/versions/#{version}"
489489
formatter SimpleCov::Formatter::HTMLFormatter
490490
end
491491
end

ext/datadog_profiling_native_extension/native_extension_helpers.rb

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@ module Profiling
66
module NativeExtensionHelpers
77
# Can be set when customers want to skip compiling the native extension entirely
88
ENV_NO_EXTENSION = "DD_PROFILING_NO_EXTENSION"
9-
LEGACY_ENV_NO_EXTENSION = "DD_NO_EXTENSION"
109
# Can be set to force rubygems to fail gem installation when profiling extension could not be built
1110
ENV_FAIL_INSTALL_IF_MISSING_EXTENSION = "DD_PROFILING_FAIL_INSTALL_IF_MISSING_EXTENSION"
12-
LEGACY_ENV_FAIL_INSTALL_IF_MISSING_EXTENSION = "DD_FAIL_INSTALL_IF_MISSING_EXTENSION"
1311

1412
# The MJIT header was introduced on 2.6 and removed on 3.3; for other Rubies we rely on datadog-ruby_core_source
1513
CAN_USE_MJIT_HEADER = RUBY_VERSION.start_with?("2.6", "2.7", "3.0.", "3.1.", "3.2.")
1614

1715
def self.fail_install_if_missing_extension?
18-
[
19-
ENV[ENV_FAIL_INSTALL_IF_MISSING_EXTENSION],
20-
ENV[LEGACY_ENV_FAIL_INSTALL_IF_MISSING_EXTENSION],
21-
].any? { |value| value.to_s.strip.downcase == "true" }
16+
ENV[ENV_FAIL_INSTALL_IF_MISSING_EXTENSION].to_s.strip.downcase == "true"
2217
end
2318

2419
# Used to check if profiler is supported, including user-visible clear messages explaining why their
@@ -136,19 +131,15 @@ def self.render_skipped_reason_file(reason:, suggested:)
136131
"<https://github.com/DataDog/dd-trace-rb/issues/new> so we can fix it :)",
137132
].freeze
138133

139-
env_var =
140-
[
141-
ENV_NO_EXTENSION,
142-
LEGACY_ENV_NO_EXTENSION,
143-
].find { |var| ENV[var].to_s.strip.downcase == "true" }
144-
145-
return unless env_var
146-
147-
explain_issue(
148-
"the `#{env_var}` environment variable is/was set to",
134+
disabled_via_env = explain_issue(
135+
"the `DD_PROFILING_NO_EXTENSION` environment variable is/was set to",
149136
"`true` during installation.",
150137
suggested: report_disabled,
151138
)
139+
140+
return unless ENV[ENV_NO_EXTENSION].to_s.strip.downcase == "true"
141+
142+
disabled_via_env
152143
end
153144

154145
private_class_method def self.on_jruby?

spec/datadog/core/crashtracking/component_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,18 @@ def ruby_method_with_c_calls
392392
)
393393
)
394394

395+
expect(frames).to include(
396+
hash_including(
397+
function: 'ruby_method_with_c_calls'
398+
)
399+
)
400+
401+
expect(frames).to include(
402+
hash_including(
403+
function: 'top_level_ruby_method'
404+
)
405+
)
406+
395407
temp_script.unlink
396408
end
397409
end

0 commit comments

Comments
 (0)