Skip to content

Commit 6b6ec18

Browse files
authored
Merge pull request #4356 from DataDog/ivoanjo/prof-11311-remove-profiling-loader
[PROF-11311] Remove datadog_profiling_loader
2 parents 8295f62 + db67572 commit 6b6ec18

File tree

9 files changed

+8
-315
lines changed

9 files changed

+8
-315
lines changed

.github/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dev/testing:
1818
# Changes to Profiling
1919
profiling:
2020
- changed-files:
21-
- any-glob-to-any-file: [ '{lib/datadog/profiling/**,ext/datadog_profiling_loader/**,ext/datadog_profiling_native_extension/**}' ]
21+
- any-glob-to-any-file: [ '{lib/datadog/profiling/**,ext/datadog_profiling_native_extension/**}' ]
2222

2323
# Changes to CI-App
2424
ci-app:

Rakefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,10 +435,6 @@ NATIVE_EXTS = [
435435
ext.ext_dir = 'ext/datadog_profiling_native_extension'
436436
end,
437437

438-
Rake::ExtensionTask.new("datadog_profiling_loader.#{RUBY_VERSION}_#{RUBY_PLATFORM}") do |ext|
439-
ext.ext_dir = 'ext/datadog_profiling_loader'
440-
end,
441-
442438
Rake::ExtensionTask.new("libdatadog_api.#{RUBY_VERSION[/\d+.\d+/]}_#{RUBY_PLATFORM}") do |ext|
443439
ext.ext_dir = 'ext/libdatadog_api'
444440
end

datadog.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ Gem::Specification.new do |spec|
8383

8484
spec.extensions = [
8585
'ext/datadog_profiling_native_extension/extconf.rb',
86-
'ext/datadog_profiling_loader/extconf.rb',
8786
'ext/libdatadog_api/extconf.rb'
8887
]
8988
end

ext/datadog_profiling_loader/.clang-format

Lines changed: 0 additions & 1 deletion
This file was deleted.

ext/datadog_profiling_loader/datadog_profiling_loader.c

Lines changed: 0 additions & 142 deletions
This file was deleted.

ext/datadog_profiling_loader/extconf.rb

Lines changed: 0 additions & 60 deletions
This file was deleted.

ext/datadog_profiling_native_extension/profiling.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ static VALUE _native_malloc_stats(DDTRACE_UNUSED VALUE _self);
4141
static VALUE _native_safe_object_info(DDTRACE_UNUSED VALUE _self, VALUE obj);
4242

4343
void DDTRACE_EXPORT Init_datadog_profiling_native_extension(void) {
44+
// The profiler still has a lot of limitations around being used in Ractors BUT for now we're choosing to take care of those
45+
// on our side, rather than asking Ruby to block calling our APIs from Ractors.
46+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
47+
rb_ext_ractor_safe(true);
48+
#endif
49+
4450
VALUE datadog_module = rb_define_module("Datadog");
4551
VALUE profiling_module = rb_define_module_under(datadog_module, "Profiling");
4652
VALUE native_extension_module = rb_define_module_under(profiling_module, "NativeExtension");
Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,9 @@
11
# frozen_string_literal: true
22

3-
# This file is used to load the profiling native extension. It works in two steps:
4-
#
5-
# 1. Load the datadog_profiling_loader extension. This extension will be used to load the actual extension, but in
6-
# a special way that avoids exposing native-level code symbols. See `datadog_profiling_loader.c` for more details.
7-
#
8-
# 2. Use the Datadog::Profiling::Loader exposed by the datadog_profiling_loader extension to load the actual
9-
# profiling native extension.
10-
#
11-
# All code on this file is on-purpose at the top-level; this makes it so this file is executed only once,
12-
# the first time it gets required, to avoid any issues with the native extension being initialized more than once.
13-
143
begin
15-
require "datadog_profiling_loader.#{RUBY_VERSION}_#{RUBY_PLATFORM}"
4+
require "datadog_profiling_native_extension.#{RUBY_VERSION}_#{RUBY_PLATFORM}"
165
rescue LoadError => e
176
raise LoadError,
187
"Failed to load the profiling loader extension. To fix this, please remove and then reinstall datadog " \
198
"(Details: #{e.message})"
209
end
21-
22-
extension_name = "datadog_profiling_native_extension.#{RUBY_VERSION}_#{RUBY_PLATFORM}"
23-
file_name = "#{extension_name}.#{RbConfig::CONFIG["DLEXT"]}"
24-
full_file_path = "#{__dir__}/../../#{file_name}"
25-
26-
unless File.exist?(full_file_path)
27-
extension_dir = Gem.loaded_specs["datadog"].extension_dir
28-
candidate_path = "#{extension_dir}/#{file_name}"
29-
if File.exist?(candidate_path)
30-
full_file_path = candidate_path
31-
else
32-
# We found none of the files. This is unexpected. Let's go ahead anyway, the error is going to be reported further
33-
# down anyway.
34-
end
35-
end
36-
37-
init_function_name = "Init_#{extension_name.split(".").first}"
38-
39-
status, result = Datadog::Profiling::Loader._native_load(full_file_path, init_function_name)
40-
41-
raise "Failure to load #{extension_name} due to #{result}" if status == :error

spec/datadog/profiling/load_native_extension_spec.rb

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)