Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PROF-11306] Upgrade libdatadog dependency to 16.0.1 #4353

Merged
merged 5 commits into from
Feb 10, 2025

Conversation

ivoanjo
Copy link
Member

@ivoanjo ivoanjo commented Feb 6, 2025

What does this PR do?

This PR upgrades the datadog gem to use libdatadog 16.0.1.

It includes a few changes to match breaking API updates in crashtracking.

Motivation:

Libdatadog 16 is needed to unblock #4331 .

This version also brings a few crashtracking improvements.

Change log entry

Yes. Upgrade libdatadog dependency to 16.0.1

Additional Notes:

As usual, I'm opening this PR as a draft as libdatadog 16.0.1 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.

Update: v16.0.1 now up on rubygems.org

How to test the change?

Our existing test coverage includes libdatadog testing, so a green C is good here :)

ivoanjo added a commit to DataDog/libdatadog that referenced this pull request Feb 7, 2025
**What does this PR do?**

This PR includes the changes documented in the "Releasing a new version
to rubygems.org" part of the README:
https://github.com/datadog/libdatadog/tree/main/ruby#releasing-a-new-version-to-rubygemsorg

**Motivation:**

Enable Ruby to use libdatadog v16.0.1. Of particular interest, this
includes improvements to crashtracking and the managed string table
needed by DataDog/dd-trace-rb#4331 .

**Additional Notes:**

N/A

**How to test the change?**

I've tested this release locally using the changes in
DataDog/dd-trace-rb#4353 .

As a reminder, new libdatadog releases don't get automatically picked up
by dd-trace-rb, so the PR that bumps the Ruby profiler will also test
this release against all supported Ruby versions.
ivoanjo added a commit to DataDog/libdatadog that referenced this pull request Feb 10, 2025
**What does this PR do?**

This PR includes the changes documented in the "Releasing a new version
to rubygems.org" part of the README:
https://github.com/datadog/libdatadog/tree/main/ruby#releasing-a-new-version-to-rubygemsorg

**Motivation:**

Enable Ruby to use libdatadog v16.0.1. Of particular interest, this
includes improvements to crashtracking and the managed string table
needed by DataDog/dd-trace-rb#4331 .

**Additional Notes:**

N/A

**How to test the change?**

I've tested this release locally using the changes in
DataDog/dd-trace-rb#4353 .

As a reminder, new libdatadog releases don't get automatically picked up
by dd-trace-rb, so the PR that bumps the Ruby profiler will also test
this release against all supported Ruby versions.
@ivoanjo ivoanjo marked this pull request as ready for review February 10, 2025 10:22
@ivoanjo ivoanjo requested review from a team as code owners February 10, 2025 10:22
@datadog-datadog-prod-us1
Copy link
Contributor

datadog-datadog-prod-us1 bot commented Feb 10, 2025

Datadog Report

Branch report: ivoanjo/prof-11306-libdatadog16_0_1-upgrade
Commit report: 78670f1
Test service: dd-trace-rb

✅ 0 Failed, 22023 Passed, 1477 Skipped, 6m 8.59s Total Time

ivoanjo and others added 5 commits February 10, 2025 10:43
**What does this PR do?**

This PR updates the crasktracker C code to build with the latest
libdatadog changes (in main) that will become part of libdatadog 15.

**Motivation:**

I'm working on a libdatadog branch and had to do this to unblock
my work, so I decided I'll create a PR with it so nobody needs to
repeat this work.

**Additional Notes:**

I'm opening this PR as draft as we shouldn't merge this until
libdatadog 15 is out.

**How to test the change?**

Existing test coverage is enough to validate this.
**What does this PR do?**

This PR upgrades the datadog gem to use libdatadog 16.0.1.

It includes a few changes to match breaking API updates in
crashtracking.

**Motivation:**

Libdatadog 16 is needed to unblock
#4331 .

This version also brings a few crashtracking improvements.

**Change log entry**

Yes. Upgrade libdatadog dependency to 16.0.1

**Additional Notes:**

As usual, I'm opening this PR as a draft as libdatadog 16.0.1 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 C
is good here :)
Fixes these bogus warnings (that get turned into errors in our CI):

```
../../../../ext/datadog_profiling_native_extension/collectors_stack.c: In function ‘sample_thread’:
../../../../ext/datadog_profiling_native_extension/collectors_stack.c:303:7: error: missing initializer for field ‘build_id_id’ of ‘struct ddog_prof_Mapping’ [-Werror=missing-field-initializers]
  303 |       .mapping = {.filename = DDOG_CHARSLICE_C(""), .build_id = DDOG_CHARSLICE_C("")},
      |       ^
In file included from /usr/local/bundle/gems/libdatadog-16.0.1.1.0-x86_64-linux/vendor/libdatadog-16.0.1/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/../../include/datadog/profiling.h:13,
                 from ../../../../ext/datadog_profiling_native_extension/libdatadog_helpers.h:3,
                 from ../../../../ext/datadog_profiling_native_extension/collectors_stack.c:5:
/usr/local/bundle/gems/libdatadog-16.0.1.1.0-x86_64-linux/vendor/libdatadog-16.0.1/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/../../include/datadog/common.h:520:36: note: ‘build_id_id’ declared here
  520 |   struct ddog_prof_ManagedStringId build_id_id;
      |                                    ^~~~~~~~~~~
../../../../ext/datadog_profiling_native_extension/collectors_stack.c: In function ‘maybe_add_placeholder_frames_omitted’:
../../../../ext/datadog_profiling_native_extension/collectors_stack.c:382:5: error: missing initializer for field ‘build_id_id’ of ‘struct ddog_prof_Mapping’ [-Werror=missing-field-initializers]
  382 |     .mapping = {.filename = DDOG_CHARSLICE_C(""), .build_id = DDOG_CHARSLICE_C("")},
      |     ^
In file included from /usr/local/bundle/gems/libdatadog-16.0.1.1.0-x86_64-linux/vendor/libdatadog-16.0.1/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/../../include/datadog/profiling.h:13,
                 from ../../../../ext/datadog_profiling_native_extension/libdatadog_helpers.h:3,
                 from ../../../../ext/datadog_profiling_native_extension/collectors_stack.c:5:
/usr/local/bundle/gems/libdatadog-16.0.1.1.0-x86_64-linux/vendor/libdatadog-16.0.1/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/../../include/datadog/common.h:520:36: note: ‘build_id_id’ declared here
  520 |   struct ddog_prof_ManagedStringId build_id_id;
      |                                    ^~~~~~~~~~~
../../../../ext/datadog_profiling_native_extension/collectors_stack.c: In function ‘record_placeholder_stack’:
../../../../ext/datadog_profiling_native_extension/collectors_stack.c:429:5: error: missing initializer for field ‘build_id_id’ of ‘struct ddog_prof_Mapping’ [-Werror=missing-field-initializers]
  429 |     .mapping = {.filename = DDOG_CHARSLICE_C(""), .build_id = DDOG_CHARSLICE_C("")},
      |     ^
In file included from /usr/local/bundle/gems/libdatadog-16.0.1.1.0-x86_64-linux/vendor/libdatadog-16.0.1/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/../../include/datadog/profiling.h:13,
                 from ../../../../ext/datadog_profiling_native_extension/libdatadog_helpers.h:3,
                 from ../../../../ext/datadog_profiling_native_extension/collectors_stack.c:5:
/usr/local/bundle/gems/libdatadog-16.0.1.1.0-x86_64-linux/vendor/libdatadog-16.0.1/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/../../include/datadog/common.h:520:36: note: ‘build_id_id’ declared here
  520 |   struct ddog_prof_ManagedStringId build_id_id;
      |                                    ^~~~~~~~~~~
cc1: all warnings being treated as errors
```
@ivoanjo ivoanjo force-pushed the ivoanjo/prof-11306-libdatadog16_0_1-upgrade branch from 3d3f11e to 78670f1 Compare February 10, 2025 10:43
@github-actions github-actions bot added the profiling Involves Datadog profiling label Feb 10, 2025
@pr-commenter
Copy link

pr-commenter bot commented Feb 10, 2025

Benchmarks

Benchmark execution time: 2025-02-10 11:07:30

Comparing candidate commit 78670f1 in PR branch ivoanjo/prof-11306-libdatadog16_0_1-upgrade with baseline commit 9404631 in branch master.

Found 0 performance improvements and 1 performance regressions! Performance is the same for 30 metrics, 2 unstable metrics.

scenario:profiler - sample timeline=false

  • 🟥 throughput [-0.340op/s; -0.330op/s] or [-5.186%; -5.030%]

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.74%. Comparing base (9404631) to head (78670f1).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4353      +/-   ##
==========================================
+ Coverage   97.72%   97.74%   +0.01%     
==========================================
  Files        1347     1347              
  Lines       82349    82349              
  Branches     4187     4187              
==========================================
+ Hits        80475    80488      +13     
+ Misses       1874     1861      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

ivoanjo added a commit to DataDog/vaccine that referenced this pull request Feb 10, 2025
**What does this PR do?**

This PR fixes the crashtracking specs failing on
https://github.com/Datadog/vaccine/actions/runs/13239150949
(from DataDog/dd-trace-rb#4353 )
due to the `additional_stacktraces` key no longer being included in
the payload.

Since I removed the assertion on the key, the updated test will
work on both libdatadog < v16 as well as >= v16.

**Motivation:**

Unblock upgrade to libdatadog v16.

**Additional Notes:**

To get the "records", I needed to

1. Clone catadog, bundle install
2. mkdir records
3. bundle exec bin/catadog --record records --no-forward

...and then `kill -SEGV` a Ruby process that had dd-trace-rb loaded.

This was enough for me:

```bash
DD_TRACE_AGENT_PORT=8128 be ruby -e "require 'datadog'; Datadog.configure { }; sleep"
```

**How to test the change?**

I've gathered the records from both libdatadog < v16 and v16
in https://gist.github.com/ivoanjo/52314e67602f2039bdcfe4ab869701b2
and used them to validate this change.

By placing them into a directory, they can be validated as such:

```bash
RECORDS_DIR=records-new/ bundle exec rspec spec/records_spec.rb
```
@ivoanjo ivoanjo merged commit 595581d into master Feb 10, 2025
503 checks passed
@ivoanjo ivoanjo deleted the ivoanjo/prof-11306-libdatadog16_0_1-upgrade branch February 10, 2025 14:30
@github-actions github-actions bot added this to the 2.11.0 milestone Feb 10, 2025
@ivoanjo ivoanjo added the core Involves Datadog core libraries label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries profiling Involves Datadog profiling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants