Skip to content

Commit

Permalink
[PROF-10208] Upgrade to libdatadog 11
Browse files Browse the repository at this point in the history
**What does this PR do?**

This PR upgrades the datadog gem to use libdatadog 11.

There were some minor tweaks needed in the crashtracker APIs, but
otherwise it's a drop-in upgrade.

**Motivation:**

Staying on the latest libdatadog enables us to pick up the
latest improvements and also makes it easier to develop new features
that need libdatadog changes.

**Additional Notes:**

As usual, I'm opening this PR as a draft as libdatadog 11 is not yet
available on rubygems.org, and I'll come back to re-trigger CI and mark
this as non-draft once it is.

**How to test the change?**

Our existing test coverage includes libdatadog testing, so a green CI
is good here :)
  • Loading branch information
ivoanjo committed Jul 22, 2024
1 parent 40d80cd commit 7bcdf97
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion datadog.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Gem::Specification.new do |spec|
# Used by profiling (and possibly others in the future)
# 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', '~> 10.0.0.1.0'
spec.add_dependency 'libdatadog', '~> 11.0.0.1.0'

spec.extensions = ['ext/datadog_profiling_native_extension/extconf.rb', 'ext/datadog_profiling_loader/extconf.rb']
end
5 changes: 4 additions & 1 deletion ext/datadog_profiling_native_extension/crashtracker.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ static VALUE _native_start_or_update_on_fork(int argc, VALUE *argv, DDTRACE_UNUS
.endpoint = endpoint,
.resolve_frames = DDOG_PROF_STACKTRACE_COLLECTION_ENABLED_WITH_SYMBOLS_IN_RECEIVER,
.timeout_secs = FIX2INT(upload_timeout_seconds),
// Waits for crash tracker to finish reporting the issue before letting the Ruby process die; see
// https://github.com/DataDog/libdatadog/pull/477 for details
.wait_for_receiver = true,
};

ddog_prof_CrashtrackerMetadata metadata = {
Expand All @@ -83,7 +86,7 @@ static VALUE _native_start_or_update_on_fork(int argc, VALUE *argv, DDTRACE_UNUS

ddog_prof_CrashtrackerResult result =
action == start_action ?
ddog_prof_Crashtracker_init(config, receiver_config, metadata) :
ddog_prof_Crashtracker_init_with_receiver(config, receiver_config, metadata) :
ddog_prof_Crashtracker_update_on_fork(config, receiver_config, metadata);

// Clean up before potentially raising any exceptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module NativeExtensionHelpers
# The MJIT header was introduced on 2.6 and removed on 3.3; for other Rubies we rely on debase-ruby_core_source
CAN_USE_MJIT_HEADER = RUBY_VERSION.start_with?('2.6', '2.7', '3.0.', '3.1.', '3.2.')

LIBDATADOG_VERSION = '~> 10.0.0.1.0'
LIBDATADOG_VERSION = '~> 11.0.0.1.0'

def self.fail_install_if_missing_extension?
ENV[ENV_FAIL_INSTALL_IF_MISSING_EXTENSION].to_s.strip.downcase == 'true'
Expand Down

0 comments on commit 7bcdf97

Please sign in to comment.