Skip to content

Merge profiling and libnative libraries. #13603

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

hoolioh
Copy link

@hoolioh hoolioh commented Jun 5, 2025

Consolidate profiling a libnative dependencies in order to save some binary size due to duplicated symbols:

  • Add new cmake file to find libnative components.
  • Modify dd_wrapper cmake in order to link against libnative.
  • Modify ddup cmake in order to link against libnative.
  • Change crashtracker compilation so it links agains libnative. Link to python runtime as a workaround to solve secondary dependencies from libnative.so (temporary until the crashtracker PyO3 bindings are ready).

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

Copy link
Contributor

github-actions bot commented Jun 5, 2025

CODEOWNERS have been resolved as:

build_libnative.py                                                      @DataDog/apm-core-python
ddtrace/internal/datadog/profiling/cmake/FindLibNative.cmake            @DataDog/profiling-python
src/native/.cargo/config.toml                                           @DataDog/apm-core-python
ddtrace/internal/datadog/profiling/build_standalone.sh                  @DataDog/profiling-python
ddtrace/internal/datadog/profiling/crashtracker/CMakeLists.txt          @DataDog/profiling-python
ddtrace/internal/datadog/profiling/dd_wrapper/CMakeLists.txt            @DataDog/profiling-python
ddtrace/internal/datadog/profiling/dd_wrapper/test/CMakeLists.txt       @DataDog/profiling-python
ddtrace/internal/datadog/profiling/ddup/CMakeLists.txt                  @DataDog/profiling-python
setup.py                                                                @DataDog/python-guild
src/native/Cargo.lock                                                   @DataDog/apm-core-python
src/native/Cargo.toml                                                   @DataDog/apm-core-python
src/native/lib.rs                                                       @DataDog/apm-core-python

@hoolioh hoolioh force-pushed the julio/consolidate-libdatadog-symbols branch from ebe5c5a to 61dd601 Compare June 5, 2025 11:18
@hoolioh hoolioh force-pushed the julio/consolidate-libdatadog-symbols branch from d77a90c to ef5d308 Compare June 9, 2025 10:17
* Add new cmake file to find libnative components.
* Modify dd_wrapper cmake in order to link against libnative.
* Modify ddup cmake in order to link against libnative.
* Change crashtracker compilation so it links agains libnative. Link to
  python runtime as a workaround to solve secondary dependencies from
  libnative.so (temporary until the crashtracker PyO3 bindings are
  ready).
@hoolioh hoolioh force-pushed the julio/consolidate-libdatadog-symbols branch from ef5d308 to 96a1446 Compare June 9, 2025 10:21
@hoolioh hoolioh force-pushed the julio/consolidate-libdatadog-symbols branch from 96a1446 to b48d766 Compare June 9, 2025 10:25
@hoolioh hoolioh added the changelog/no-changelog A changelog entry is not required for this PR. label Jun 9, 2025
* Call build_libnative from project's root folder.
* Fix FindLibNative in order not to include libnative whole folder
  structure.
* Workaround test linking.
@hoolioh hoolioh force-pushed the julio/consolidate-libdatadog-symbols branch from 07c8bb9 to 5659b91 Compare June 9, 2025 13:14
@hoolioh hoolioh force-pushed the julio/consolidate-libdatadog-symbols branch 2 times, most recently from cce59ac to adebc6d Compare June 18, 2025 08:50
@P403n1x87
Copy link
Contributor

While investigating the root cause of slow builds, we discovered that the main culprit is our current usage of CMake. In the long-run, we would want to migrate away from CMake, at least when building Python native extensions. IIUC here we go in the opposite direction as we remove the rust extension from setup.py and move the heavy-lifting to CMake + more custom scripts. My concern is that this would contribute to the build time, while also giving us even more code to maintain.

@hoolioh hoolioh force-pushed the julio/consolidate-libdatadog-symbols branch from adebc6d to 7a4b2c1 Compare June 18, 2025 09:28
@hoolioh hoolioh closed this Jun 18, 2025
@hoolioh hoolioh reopened this Jun 18, 2025
@hoolioh hoolioh force-pushed the julio/consolidate-libdatadog-symbols branch from 7a4b2c1 to 7458185 Compare June 18, 2025 09:50
@brettlangdon brettlangdon reopened this Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/no-changelog A changelog entry is not required for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants