From a4797d322ba8d18ae2fa958d4bafa2840629af8c Mon Sep 17 00:00:00 2001 From: William Conti <58711692+wconti27@users.noreply.github.com> Date: Thu, 3 Oct 2024 19:11:06 -0400 Subject: [PATCH 1/3] chore: prefix system tests env var (#10887) Added prefix to env var to not conflict with local dev env vars ## Checklist - [x] 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](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] 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](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) 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](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) --- .github/workflows/system-tests.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/system-tests.yml b/.github/workflows/system-tests.yml index f57efa3dea..e40b909532 100644 --- a/.github/workflows/system-tests.yml +++ b/.github/workflows/system-tests.yml @@ -57,10 +57,8 @@ jobs: # If ever it's needed, a valid key exists in the repo, using ${{ secrets.DD_API_KEY }} DD_API_KEY: 1234567890abcdef1234567890abcdef CMAKE_BUILD_PARALLEL_LEVEL: 12 - AWS_ACCESS_KEY_ID: ${{ secrets.IDM_AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.IDM_AWS_SECRET_ACCESS_KEY }} - AWS_REGION: us-east-1 - AWS_DEFAULT_REGION: us-east-1 # AWS services should use `AWS_REGION`, but some still use the older `AWS_DEFAULT_REGION` + SYSTEM_TESTS_AWS_ACCESS_KEY_ID: ${{ secrets.IDM_AWS_ACCESS_KEY_ID }} + SYSTEM_TESTS_AWS_SECRET_ACCESS_KEY: ${{ secrets.IDM_AWS_SECRET_ACCESS_KEY }} steps: - name: Checkout system tests @@ -109,10 +107,8 @@ jobs: # If ever it's needed, a valid key exists in the repo, using ${{ secrets.DD_API_KEY }} DD_API_KEY: 1234567890abcdef1234567890abcdef CMAKE_BUILD_PARALLEL_LEVEL: 12 - AWS_ACCESS_KEY_ID: ${{ secrets.IDM_AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.IDM_AWS_SECRET_ACCESS_KEY }} - AWS_REGION: us-east-1 - AWS_DEFAULT_REGION: us-east-1 # AWS services should use `AWS_REGION`, but some still use the older `AWS_DEFAULT_REGION` + SYSTEM_TESTS_AWS_ACCESS_KEY_ID: ${{ secrets.IDM_AWS_ACCESS_KEY_ID }} + SYSTEM_TESTS_AWS_SECRET_ACCESS_KEY: ${{ secrets.IDM_AWS_SECRET_ACCESS_KEY }} steps: - name: Checkout system tests From dd0891e87f8e86ae9a7bedfa2ef580536fe82379 Mon Sep 17 00:00:00 2001 From: Taegyun Kim Date: Thu, 3 Oct 2024 20:47:38 -0400 Subject: [PATCH 2/3] chore(profiling): upgrade libdatadog to v13.1.0 (#10813) ## Checklist - [x] 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](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] 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](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) 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](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) --- .../datadog/profiling/cmake/FindLibdatadog.cmake | 2 +- .../profiling/cmake/tools/libdatadog_checksums.txt | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ddtrace/internal/datadog/profiling/cmake/FindLibdatadog.cmake b/ddtrace/internal/datadog/profiling/cmake/FindLibdatadog.cmake index a58ef07b8a..e5fdfa6bb7 100644 --- a/ddtrace/internal/datadog/profiling/cmake/FindLibdatadog.cmake +++ b/ddtrace/internal/datadog/profiling/cmake/FindLibdatadog.cmake @@ -5,7 +5,7 @@ endif() include(ExternalProject) set(TAG_LIBDATADOG - "v12.0.0" + "v13.1.0" CACHE STRING "libdatadog github tag") set(Datadog_BUILD_DIR ${CMAKE_BINARY_DIR}/libdatadog) diff --git a/ddtrace/internal/datadog/profiling/cmake/tools/libdatadog_checksums.txt b/ddtrace/internal/datadog/profiling/cmake/tools/libdatadog_checksums.txt index f6aa2767f8..6cdf96c58e 100644 --- a/ddtrace/internal/datadog/profiling/cmake/tools/libdatadog_checksums.txt +++ b/ddtrace/internal/datadog/profiling/cmake/tools/libdatadog_checksums.txt @@ -1,4 +1,5 @@ -8e7b429fcd7476cd800c041d8196e908b3a85ce6817e852f18f57a200c89e22a libdatadog-aarch64-alpine-linux-musl.tar.gz -a78da9ed45cb301dc9aa43e6ca16df789c9dd845417f0ac4feee895f4df63ad4 libdatadog-aarch64-unknown-linux-gnu.tar.gz -67d518a17147ea29383c4a6d72805a542dca1cb94f9233b322b510254b93ac0f libdatadog-x86_64-alpine-linux-musl.tar.gz -d4fd8bc13042d6c3c78cc5526b969d1279b26021858a470e25d25599bffd4f5f libdatadog-x86_64-unknown-linux-gnu.tar.gz +9cddbc9ece4c2fe9a1f0ab5a7cfed218d617c5154f318e0bce9a6102b265c989 libdatadog-aarch64-alpine-linux-musl.tar.gz +d1f7c6213793bdb520aa78e33a2f4edce187470c7d07cbf21413e954c04bb06f libdatadog-aarch64-apple-darwin.tar.gz +db17a5873d82ef772f969582949b272dcd04044a0cd08b196d3820172a19814d libdatadog-aarch64-unknown-linux-gnu.tar.gz +46d0e6445fa1b0fbe8d079e6fa997fa10a4fef4084fe10f4b5886c92effc7be8 libdatadog-x86_64-alpine-linux-musl.tar.gz +adaf79470fd0b06ce6d63ae8f231e555fa12b70d5bf82565a96a25f59ea8071d libdatadog-x86_64-unknown-linux-gnu.tar.gz From b03f6ad1bfcc5ed0f45cdc550f59ca9b0a252e03 Mon Sep 17 00:00:00 2001 From: "Gabriele N. Tornetta" Date: Fri, 4 Oct 2024 09:58:10 +0100 Subject: [PATCH 3/3] refactor: migrate RCM to the product interface (#10900) We migrate the RCM life-cycle management to the new product plugin interface. ## Checklist - [x] 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](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## 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](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) 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](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) --- ddtrace/bootstrap/preload.py | 6 ---- ddtrace/internal/remoteconfig/product.py | 33 +++++++++++++++++++ ddtrace/internal/remoteconfig/worker.py | 4 +-- pyproject.toml | 3 ++ .../remoteconfig/test_remoteconfig.py | 2 +- 5 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 ddtrace/internal/remoteconfig/product.py diff --git a/ddtrace/bootstrap/preload.py b/ddtrace/bootstrap/preload.py index c8959cefb3..93eba3cc6e 100644 --- a/ddtrace/bootstrap/preload.py +++ b/ddtrace/bootstrap/preload.py @@ -105,12 +105,6 @@ def register_post_preload(func: t.Callable) -> None: enable_iast_propagation() -if config._remote_config_enabled: - from ddtrace.internal.remoteconfig.worker import remoteconfig_poller - - remoteconfig_poller.enable() - config.enable_remote_configuration() - if asm_config._asm_enabled or config._remote_config_enabled: from ddtrace.appsec._remoteconfiguration import enable_appsec_rc diff --git a/ddtrace/internal/remoteconfig/product.py b/ddtrace/internal/remoteconfig/product.py new file mode 100644 index 0000000000..f7d1ff04fd --- /dev/null +++ b/ddtrace/internal/remoteconfig/product.py @@ -0,0 +1,33 @@ +from ddtrace import config +from ddtrace.internal.remoteconfig.client import config as rc_config + + +def post_preload(): + pass + + +def start(): + if config._remote_config_enabled: + from ddtrace.internal.remoteconfig.worker import remoteconfig_poller + + remoteconfig_poller.enable() + config.enable_remote_configuration() + + +def restart(join=False): + if config._remote_config_enabled: + from ddtrace.internal.remoteconfig.worker import remoteconfig_poller + + remoteconfig_poller.reset_at_fork() + + +def stop(join=False): + if config._remote_config_enabled: + from ddtrace.internal.remoteconfig.worker import remoteconfig_poller + + remoteconfig_poller.disable(join=join) + + +def at_exit(join=False): + if config._remote_config_enabled and not rc_config.skip_shutdown: + stop(join=join) diff --git a/ddtrace/internal/remoteconfig/worker.py b/ddtrace/internal/remoteconfig/worker.py index be6b814101..7ad8c592d2 100644 --- a/ddtrace/internal/remoteconfig/worker.py +++ b/ddtrace/internal/remoteconfig/worker.py @@ -83,9 +83,7 @@ def enable(self): return True self.start() - forksafe.register(self.reset_at_fork) - if not rc_config.skip_shutdown: - atexit.register(self.disable) + return True return False diff --git a/pyproject.toml b/pyproject.toml index 045c68221e..64adf321d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,6 +56,9 @@ ddtrace = "ddtrace.contrib.pytest.plugin" "ddtrace.pytest_bdd" = "ddtrace.contrib.pytest_bdd.plugin" "ddtrace.pytest_benchmark" = "ddtrace.contrib.pytest_benchmark.plugin" +[project.entry-points.'ddtrace.products'] +"remote-configuration" = "ddtrace.internal.remoteconfig.product" + [project.urls] "Bug Tracker" = "https://github.com/DataDog/dd-trace-py/issues" Changelog = "https://github.com/DataDog/dd-trace-py/releases" diff --git a/tests/internal/remoteconfig/test_remoteconfig.py b/tests/internal/remoteconfig/test_remoteconfig.py index feb83b775d..4875da2bfb 100644 --- a/tests/internal/remoteconfig/test_remoteconfig.py +++ b/tests/internal/remoteconfig/test_remoteconfig.py @@ -188,7 +188,7 @@ def test_remote_config_enable_validate_rc_disabled(remote_config_worker): sys.version_info >= (3, 12, 0), reason="Python 3.12 subprocess will raise deprecation warning for forking in a multi-threaded process", ) -@pytest.mark.subprocess(env=dict(DD_REMOTE_CONFIGURATION_ENABLED="true")) +@pytest.mark.subprocess(ddtrace_run=True, env=dict(DD_REMOTE_CONFIGURATION_ENABLED="true")) def test_remote_config_forksafe(): import os