Skip to content

Commit

Permalink
Changed: Profiling 'ddtrace' references to 'datadog' (except C code)
Browse files Browse the repository at this point in the history
  • Loading branch information
delner committed Feb 26, 2024
1 parent 59aa74f commit bcee292
Show file tree
Hide file tree
Showing 71 changed files with 88 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dev/testing:

# Changes to Profiling
profiling:
- any: [ '{lib/datadog/profiling/**,ext/ddtrace_profiling_loader/**,ext/ddtrace_profiling_native_extension/**}' ]
- any: [ '{lib/datadog/profiling/**,ext/datadog_profiling_loader/**,ext/datadog_profiling_native_extension/**}' ]

# Changes to CI-App
ci-app:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"Component","Origin","License","Copyright"
"debase-ruby_core_source","https://rubygems.org/gems/debase-ruby_core_source","MIT for gem and BSD-2-Clause for Ruby sources","Copyright (c) 2012 Gabriel Horner. Files from Ruby sources are Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved."
"ext/ddtrace_profiling_native_extension/private_vm_api_access","https://github.com/ruby/ruby","BSD-2-Clause","Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved."
"ext/datadog_profiling_native_extension/private_vm_api_access","https://github.com/ruby/ruby","BSD-2-Clause","Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved."
"lib/datadog/core/vendor/multipart-post","https://github.com/socketry/multipart-post","MIT","Copyright (c) 2007-2013 Nick Sieger."
"lib/datadog/tracing/contrib/active_record/vendor","https://github.com/rails/rails/","MIT","Copyright (c) 2005-2018 David Heinemeier Hansson"
"lib/datadog/tracing/contrib/utils/quantization/http.rb","https://github.com/ruby/uri","BSD-2-Clause","Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved."
Expand Down
8 changes: 4 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -636,12 +636,12 @@ namespace :changelog do
end

NATIVE_EXTS = [
Rake::ExtensionTask.new("ddtrace_profiling_native_extension.#{RUBY_VERSION}_#{RUBY_PLATFORM}") do |ext|
ext.ext_dir = 'ext/ddtrace_profiling_native_extension'
Rake::ExtensionTask.new("datadog_profiling_native_extension.#{RUBY_VERSION}_#{RUBY_PLATFORM}") do |ext|
ext.ext_dir = 'ext/datadog_profiling_native_extension'
end,

Rake::ExtensionTask.new("ddtrace_profiling_loader.#{RUBY_VERSION}_#{RUBY_PLATFORM}") do |ext|
ext.ext_dir = 'ext/ddtrace_profiling_loader'
Rake::ExtensionTask.new("datadog_profiling_loader.#{RUBY_VERSION}_#{RUBY_PLATFORM}") do |ext|
ext.ext_dir = 'ext/datadog_profiling_loader'
end
].freeze

Expand Down
2 changes: 1 addition & 1 deletion bin/ddtracerb → bin/ddprofrb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ when 'exec'
when 'help', '--help'
Datadog::Profiling::Tasks::Help.new.run
else
puts "Command '#{command}' is not valid for ddtrace."
puts "Command '#{command}' is not valid for ddprofrb."
Datadog::Profiling::Tasks::Help.new.run
end
4 changes: 2 additions & 2 deletions datadog.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Gem::Specification.new do |spec|
.reject { |fn| fn.end_with?('.so', '.bundle') } # Exclude local profiler binary artifacts
.reject { |fn| fn.end_with?('skipped_reason.txt') } # Generated by profiler; should never be distributed

spec.executables = ['ddtracerb']
spec.executables = ['ddprofrb']
spec.require_paths = ['lib']

# Used to serialize traces to send them to the Datadog Agent.
Expand All @@ -71,5 +71,5 @@ Gem::Specification.new do |spec|
# When updating the version here, please also update the version in `native_extension_helpers.rb` (and yes we have a test for it)
spec.add_dependency 'libdatadog', '~> 6.0.0.1.0'

spec.extensions = ['ext/ddtrace_profiling_native_extension/extconf.rb', 'ext/ddtrace_profiling_loader/extconf.rb']
spec.extensions = ['ext/datadog_profiling_native_extension/extconf.rb', 'ext/datadog_profiling_loader/extconf.rb']
end
2 changes: 1 addition & 1 deletion docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ end
# In case you want to override the global configuration for a certain client instance
connection = Faraday.new('https://example.com') do |builder|
builder.use(:ddtrace, **options)
builder.use(:datadog, **options)
builder.adapter Faraday.default_adapter
end
Expand Down
2 changes: 1 addition & 1 deletion docs/ProfilingDevelopment.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ with ongoing tracing information, if any. Relies on the `Collectors::Stack` for

## Initialization

When started via `ddtracerb exec` (together with `DD_PROFILING_ENABLED=true`), initialization goes through the following
When started via `ddprofrb exec` (together with `DD_PROFILING_ENABLED=true`), initialization goes through the following
flow:

1. <../lib/datadog/profiling/preload.rb> triggers the creation of the profiler instance by calling the method `Datadog::Profiling.start_if_enabled`
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// up other's symbols (`RTLD_DEEPBIND`).
//
// But Ruby's extension loading mechanism is not configurable -- there's no way to tell it to use different flags when
// calling `dlopen`. To get around this, this file (ddtrace_profiling_loader.c) introduces another extension
// calling `dlopen`. To get around this, this file (datadog_profiling_loader.c) introduces another extension
// (profiling loader) which has only a single responsibility: mimic Ruby's extension loading mechanism, but when calling
// `dlopen` use a different set of flags.
// This idea was shamelessly stolen from @lloeki's work in https://github.com/rubyjs/mini_racer/pull/179, big thanks!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

if RUBY_ENGINE != 'ruby' || Gem.win_platform?
$stderr.puts(
'WARN: Skipping build of ddtrace profiling loader. See ddtrace profiling native extension note for details.'
'WARN: Skipping build of datadog profiling loader. See datadog profiling native extension note for details.'
)

File.write('Makefile', 'all install clean: # dummy makefile that does nothing')
Expand All @@ -28,7 +28,7 @@ def add_compiler_flag(flag)

# Older gcc releases may not default to C99 and we need to ask for this. This is also used:
# * by upstream Ruby -- search for gnu99 in the codebase
# * by msgpack, another ddtrace dependency
# * by msgpack, another datadog dependency
# (https://github.com/msgpack/msgpack-ruby/blob/18ce08f6d612fe973843c366ac9a0b74c4e50599/ext/msgpack/extconf.rb#L8)
add_compiler_flag '-std=gnu99'

Expand Down Expand Up @@ -64,7 +64,7 @@ def add_compiler_flag(flag)
# This makes it easier for development (avoids "oops I forgot to rebuild when I switched my Ruby") and ensures that
# the wrong library is never loaded.
# When requiring, we need to use the exact same string, including the version and the platform.
EXTENSION_NAME = "ddtrace_profiling_loader.#{RUBY_VERSION}_#{RUBY_PLATFORM}".freeze
EXTENSION_NAME = "datadog_profiling_loader.#{RUBY_VERSION}_#{RUBY_PLATFORM}".freeze

create_makefile(EXTENSION_NAME)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def skip_building_extension!(reason)
if fail_install_if_missing_extension
require 'mkmf'
Logging.message(
'[ddtrace] Failure cause: ' \
'[datadog] Failure cause: ' \
"#{Datadog::Profiling::NativeExtensionHelpers::Supported.render_skipped_reason_file(**reason)}\n"
)
else
Expand All @@ -43,19 +43,19 @@ def skip_building_extension!(reason)
$stderr.puts(
%(
+------------------------------------------------------------------------------+
| ** Preparing to build the ddtrace profiling native extension... ** |
| ** Preparing to build the datadog profiling native extension... ** |
| |
| If you run into any failures during this step, you can set the |
| `DD_PROFILING_NO_EXTENSION` environment variable to `true` e.g. |
| `$ DD_PROFILING_NO_EXTENSION=true bundle install` to skip this step. |
| |
| If you disable this extension, the Datadog Continuous Profiler will |
| not be available, but all other ddtrace features will work fine! |
| not be available, but all other datadog features will work fine! |
| |
| If you needed to use this, please tell us why on |
| <https://github.com/DataDog/dd-trace-rb/issues/new> so we can fix it :\) |
| |
| Thanks for using ddtrace! You rock! |
| Thanks for using datadog! You rock! |
+------------------------------------------------------------------------------+
)
Expand All @@ -65,9 +65,9 @@ def skip_building_extension!(reason)
# that may fail on an environment not properly setup for building Ruby extensions.
require 'mkmf'

Logging.message("[ddtrace] Using compiler:\n")
Logging.message("[datadog] Using compiler:\n")
xsystem("#{CONFIG['CC']} -v")
Logging.message("[ddtrace] End of compiler information\n")
Logging.message("[datadog] End of compiler information\n")

# mkmf on modern Rubies actually has an append_cflags that does something similar
# (see https://github.com/ruby/ruby/pull/5760), but as usual we need a bit more boilerplate to deal with legacy Rubies
Expand All @@ -85,7 +85,7 @@ def add_compiler_flag(flag)

# Older gcc releases may not default to C99 and we need to ask for this. This is also used:
# * by upstream Ruby -- search for gnu99 in the codebase
# * by msgpack, another ddtrace dependency
# * by msgpack, another datadog dependency
# (https://github.com/msgpack/msgpack-ruby/blob/18ce08f6d612fe973843c366ac9a0b74c4e50599/ext/msgpack/extconf.rb#L8)
add_compiler_flag '-std=gnu99'

Expand Down Expand Up @@ -205,11 +205,11 @@ def add_compiler_flag(flag)

# If we got here, libdatadog is available and loaded
ENV['PKG_CONFIG_PATH'] = "#{ENV['PKG_CONFIG_PATH']}:#{Libdatadog.pkgconfig_folder}"
Logging.message("[ddtrace] PKG_CONFIG_PATH set to #{ENV['PKG_CONFIG_PATH'].inspect}\n")
Logging.message("[datadog] PKG_CONFIG_PATH set to #{ENV['PKG_CONFIG_PATH'].inspect}\n")
$stderr.puts("Using libdatadog #{Libdatadog::VERSION} from #{Libdatadog.pkgconfig_folder}")

unless pkg_config('datadog_profiling_with_rpath')
Logging.message("[ddtrace] Ruby detected the pkg-config command is #{$PKGCONFIG.inspect}\n")
Logging.message("[datadog] Ruby detected the pkg-config command is #{$PKGCONFIG.inspect}\n")

skip_building_extension!(
if Datadog::Profiling::NativeExtensionHelpers::Supported.pkg_config_missing?
Expand All @@ -231,13 +231,13 @@ def add_compiler_flag(flag)
$LDFLAGS += \
' -Wl,-rpath,$$$\\\\{ORIGIN\\}/' \
"#{Datadog::Profiling::NativeExtensionHelpers.libdatadog_folder_relative_to_native_lib_folder}"
Logging.message("[ddtrace] After pkg-config $LDFLAGS were set to: #{$LDFLAGS.inspect}\n")
Logging.message("[datadog] After pkg-config $LDFLAGS were set to: #{$LDFLAGS.inspect}\n")

# Tag the native extension library with the Ruby version and Ruby platform.
# This makes it easier for development (avoids "oops I forgot to rebuild when I switched my Ruby") and ensures that
# the wrong library is never loaded.
# When requiring, we need to use the exact same string, including the version and the platform.
EXTENSION_NAME = "ddtrace_profiling_native_extension.#{RUBY_VERSION}_#{RUBY_PLATFORM}".freeze
EXTENSION_NAME = "datadog_profiling_native_extension.#{RUBY_VERSION}_#{RUBY_PLATFORM}".freeze

if Datadog::Profiling::NativeExtensionHelpers::CAN_USE_MJIT_HEADER
mjit_header_file_name = "rb_mjit_min_header-#{RUBY_VERSION}.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ def self.fail_install_if_missing_extension?
ENV[ENV_FAIL_INSTALL_IF_MISSING_EXTENSION].to_s.strip.downcase == 'true'
end

# Used as an workaround for a limitation with how dynamic linking works in environments where ddtrace and
# Used as an workaround for a limitation with how dynamic linking works in environments where datadog and
# libdatadog are moved after the extension gets compiled.
#
# Because the libddpprof native library is installed on a non-standard system path, in order for it to be
# found by the system dynamic linker (e.g. what takes care of dlopen(), which is used to load the profiling
# native extension), we need to add a "runpath" -- a list of folders to search for libdatadog.
#
# This runpath gets hardcoded at native library linking time. You can look at it using the `readelf` tool in
# Linux: e.g. `readelf -d ddtrace_profiling_native_extension.2.7.3_x86_64-linux.so`.
# Linux: e.g. `readelf -d datadog_profiling_native_extension.2.7.3_x86_64-linux.so`.
#
# In older versions of ddtrace, we only set as runpath an absolute path to libdatadog.
# In older versions of datadog, we only set as runpath an absolute path to libdatadog.
# (This gets set automatically by the call
# to `pkg_config('datadog_profiling_with_rpath')` in `extconf.rb`). This worked fine as long as libdatadog was **NOT**
# moved from the folder it was present at ddtrace installation/linking time.
# moved from the folder it was present at datadog installation/linking time.
#
# Unfortunately, environments such as Heroku and AWS Elastic Beanstalk move gems around in the filesystem after
# installation. Thus, the profiling native extension could not be loaded in these environments
Expand Down Expand Up @@ -107,7 +107,7 @@ def self.failure_banner_for(reason:, suggested:, fail_install:)
else
[
'The Datadog Continuous Profiler will not be available,',
'but all other ddtrace features will work fine!',
'but all other datadog features will work fine!',
]
end

Expand Down Expand Up @@ -213,15 +213,15 @@ def self.pkg_config_missing?(command: $PKGCONFIG) # rubocop:disable Style/Global

private_class_method def self.on_truffleruby?
truffleruby_not_supported = explain_issue(
'TruffleRuby is not supported by the ddtrace gem.',
'TruffleRuby is not supported by the datadog gem.',
suggested: GET_IN_TOUCH,
)

truffleruby_not_supported if RUBY_ENGINE == 'truffleruby'
end

# See https://docs.datadoghq.com/tracing/setup_overview/setup/ruby/#microsoft-windows-support for current
# state of Windows support in ddtrace.
# state of Windows support in datadog.
private_class_method def self.on_windows?
windows_not_supported = explain_issue(
'Microsoft Windows is not supported by the Datadog Continuous Profiler.',
Expand Down
8 changes: 4 additions & 4 deletions integration/apps/hanami/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ puts "\n== Starting application process =="
process = (ARGV[0] || Datadog::DemoEnv.process)
command = case process
when 'puma'
"bundle exec ddtracerb exec puma -C /app/config/puma.rb /app/config.ru"
"bundle exec ddprofrb exec puma -C /app/config/puma.rb /app/config.ru"
when 'unicorn'
"bundle exec ddtracerb exec unicorn --port 80 -c /app/config/unicorn.rb /app/config.ru"
"bundle exec ddprofrb exec unicorn --port 80 -c /app/config/unicorn.rb /app/config.ru"
when 'webrick'
"bundle exec ddtracerb exec rackup -s webrick -o 0.0.0.0 -p 80 /app/config.ru"
"bundle exec ddprofrb exec rackup -s webrick -o 0.0.0.0 -p 80 /app/config.ru"
when 'irb'
"bundle exec ddtracerb exec irb"
"bundle exec ddprofrb exec irb"
when nil, ''
abort("\n== ERROR: Must specify a application process! ==")
else
Expand Down
2 changes: 1 addition & 1 deletion integration/apps/opentelemetry/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Start application process
puts "\n== Starting application process =="

profiling = Datadog::DemoEnv.feature?('profiling') ? 'DD_PROFILING_ENABLED=true ddtracerb exec ' : ''
profiling = Datadog::DemoEnv.feature?('profiling') ? 'DD_PROFILING_ENABLED=true ddprofrb exec ' : ''
process = (ARGV[0] || Datadog::DemoEnv.process)
command = case process
when 'main'
Expand Down
2 changes: 1 addition & 1 deletion integration/apps/rack/bin/resque
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

puts "\n== Starting resque process =="

command = "QUEUE=resque_testing bundle exec ddtracerb exec rake resque:work"
command = "QUEUE=resque_testing bundle exec ddprofrb exec rake resque:work"

puts "Run: #{command}"
Kernel.exec(command)
10 changes: 5 additions & 5 deletions integration/apps/rack/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ puts "\n== Starting application process =="
process = (ARGV[0] || Datadog::DemoEnv.process)
command = case process
when 'puma'
"bundle exec ddtracerb exec puma -C /app/config/puma.rb /app/config.ru"
"bundle exec ddprofrb exec puma -C /app/config/puma.rb /app/config.ru"
when 'unicorn'
"bundle exec ddtracerb exec unicorn --port 80 -c /app/config/unicorn.rb /app/config.ru"
"bundle exec ddprofrb exec unicorn --port 80 -c /app/config/unicorn.rb /app/config.ru"
when 'webrick'
"bundle exec ddtracerb exec rackup -s webrick -o 0.0.0.0 -p 80 /app/config.ru"
"bundle exec ddprofrb exec rackup -s webrick -o 0.0.0.0 -p 80 /app/config.ru"
when 'irb'
"bundle exec ddtracerb exec irb"
"bundle exec ddprofrb exec irb"
when 'passenger'
"bundle exec ddtracerb exec passenger start --port 80 -R /app/config.ru"
"bundle exec ddprofrb exec passenger start --port 80 -R /app/config.ru"
when nil, ''
abort("\n== ERROR: Must specify a application process! ==")
else
Expand Down
2 changes: 1 addition & 1 deletion integration/apps/rack/bin/sidekiq
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

puts "\n== Starting sidekiq process =="

command = "bundle exec ddtracerb exec sidekiq -r ./app/sidekiq_background_job.rb"
command = "bundle exec ddprofrb exec sidekiq -r ./app/sidekiq_background_job.rb"

puts "Run: #{command}"
Kernel.exec(command)
8 changes: 4 additions & 4 deletions integration/apps/rails-five/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ puts "\n== Starting application process =="
process = (ARGV[0] || Datadog::DemoEnv.process)
command = case process
when 'puma'
"bundle exec ddtracerb exec puma -C /app/config/puma.rb"
"bundle exec ddprofrb exec puma -C /app/config/puma.rb"
when 'unicorn'
"bundle exec ddtracerb exec unicorn -c /app/config/unicorn.rb"
"bundle exec ddprofrb exec unicorn -c /app/config/unicorn.rb"
when 'console'
"bundle exec ddtracerb exec rails c"
"bundle exec ddprofrb exec rails c"
when 'irb'
"bundle exec ddtracerb exec irb"
"bundle exec ddprofrb exec irb"
when nil, ''
abort("\n== ERROR: Must specify a application process! ==")
else
Expand Down
8 changes: 4 additions & 4 deletions integration/apps/rails-seven/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ puts "\n== Starting application process =="
process = (ARGV[0] || Datadog::DemoEnv.process)
command = case process
when 'puma'
"bundle exec ddtracerb exec puma -C /app/config/puma.rb"
"bundle exec ddprofrb exec puma -C /app/config/puma.rb"
when 'unicorn'
"bundle exec ddtracerb exec unicorn -c /app/config/unicorn.rb"
"bundle exec ddprofrb exec unicorn -c /app/config/unicorn.rb"
when 'console'
"bundle exec ddtracerb exec rails c"
"bundle exec ddprofrb exec rails c"
when 'irb'
"bundle exec ddtracerb exec irb"
"bundle exec ddprofrb exec irb"
when nil, ''
abort("\n== ERROR: Must specify a application process! ==")
else
Expand Down
8 changes: 4 additions & 4 deletions integration/apps/rails-six/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ puts "\n== Starting application process =="
process = (ARGV[0] || Datadog::DemoEnv.process)
command = case process
when 'puma'
"bundle exec ddtracerb exec puma -C /app/config/puma.rb"
"bundle exec ddprofrb exec puma -C /app/config/puma.rb"
when 'unicorn'
"bundle exec ddtracerb exec unicorn -c /app/config/unicorn.rb"
"bundle exec ddprofrb exec unicorn -c /app/config/unicorn.rb"
when 'console'
"bundle exec ddtracerb exec rails c"
"bundle exec ddprofrb exec rails c"
when 'irb'
"bundle exec ddtracerb exec irb"
"bundle exec ddprofrb exec irb"
when nil, ''
abort("\n== ERROR: Must specify a application process! ==")
else
Expand Down
2 changes: 1 addition & 1 deletion integration/apps/rspec/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Start application process
puts "\n== Starting application process =="

profiling = Datadog::DemoEnv.feature?('profiling') ? 'DD_PROFILING_ENABLED=true ddtracerb exec ' : ''
profiling = Datadog::DemoEnv.feature?('profiling') ? 'DD_PROFILING_ENABLED=true ddprofrb exec ' : ''
process = (ARGV[0] || Datadog::DemoEnv.process)
command = case process
when 'rspec'
Expand Down
Loading

0 comments on commit bcee292

Please sign in to comment.