Skip to content

Commit

Permalink
Merge branch 'main' into sanchda/make_contextvars_indirect
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchda authored Oct 4, 2024
2 parents b661288 + b03f6ad commit 36c4835
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 23 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions ddtrace/bootstrap/preload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions ddtrace/internal/remoteconfig/product.py
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 1 addition & 3 deletions ddtrace/internal/remoteconfig/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/internal/remoteconfig/test_remoteconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 36c4835

Please sign in to comment.