refactor(parametric/python): consolidate set_and_wait_rc helpers + absorb #6951#6956
Draft
bm1549 wants to merge 1 commit into
Draft
Conversation
…tic by default) Renames set_and_wait_rc_applied -> set_and_wait_rc and deletes the prior ACK-only helper. The remaining helper waits for the test-agent ACK and then synchronously drains pending RC on tracers in _RC_APPLY_ENDPOINT_LANGS, so every RC-driven test gets deterministic behavior by default. Tracers outside the allowlist fall back to the ACK-only path transparently. All 19 call sites in tests/parametric/test_dynamic_configuration.py and the contract test in test_remote_config_apply_endpoint.py are migrated to pass test_library as the second positional argument. The APMLibrary wrapper and docs/parametric/remote-config-apply-contract.md are updated to match. Removes three flaky-test gates from manifests/python.yml that the previous ACK-only race motivated. The retry loops in test_trace_sampling_rules_override_env, test_trace_sampling_rules_override_rate, and test_remote_sampling_rules_retention go away with this change; the probabilistic retry inside get_sampled_trace stays because it handles sampling-by-chance, not the RC race. Supersedes #6951.
Contributor
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
set_and_wait_rc()waits only for the test-agent ACK. That ACK fires when the tracer's RC client validates the payload — not when product subscribers actually apply it. The gap is small for in-process tracers and large for out-of-process ones (PHP sidecar), and it's the root cause of the flaky-test gates we've been carrying. #6954 addedset_and_wait_rc_applied()as a deterministic variant that drains the tracer after the ACK, and converted two pilot tests on Python. The two-helper design was always transitional: there is no real use case for the ACK-only variant. Every behavioural test that reads tracer state after RC arrives benefits from the deterministic guarantee, and the helper degrades to the old ACK-only path for tracers outside_RC_APPLY_ENDPOINT_LANGS. This PR finishes that migration and removes the redundant helper, then absorbs the scope of #6951 — which papered over the same race with retry loops on three Python tests.Changes
The single remaining helper is
set_and_wait_rc(test_agent, test_library, config_overrides, config_id=None). It waits for the ACK, then on tracers in_RC_APPLY_ENDPOINT_LANGS(currently{"python"}) callsflush_remote_config()to synchronously drain pending RC. Tracers outside the allowlist get the ACK-only path with no behaviour change. Stacked on #6954 — base branch isbrian.marks/rc-applied-endpoint-python-pilot.tests/parametric/test_dynamic_configuration.pyset_and_wait_rc(ACK-only) with the unified helper. Renameset_and_wait_rc_applied->set_and_wait_rc. Migrate all 19 call sites to passtest_libraryas the second positional argument. Remove the retry loop intest_remote_sampling_rules_retentionthat the helper now makes redundant.tests/parametric/test_remote_config_apply_endpoint.pytest_set_and_wait_rc_applies_synchronously).utils/docker_fixtures/_test_clients/_test_client_parametric.pyflush_remote_configdocstring — most tests no longer need to call it directly.docs/parametric/remote-config-apply-contract.mdmanifests/python.ymltest_remote_sampling_rules_retention,test_trace_sampling_rules_override_env,test_trace_sampling_rules_override_rate.Design choice: rename rather than rename-and-replace
I picked Option X from the brief: take over the
set_and_wait_rcname with the new signature, rather than keepingset_and_wait_rc_appliedas the long-term name. Two reasons. First, once there is a single helper, the_appliedsuffix carries no information —set_and_wait_rcshould be the deterministic one. Second, the helper already has a transparent fallback for non-Python tracers, so existing call sites (which all already hadtest_libraryin scope) keep the same call name with one extra argument. The git blame churn is one-line-per-call-site and the rename is mechanical; net readability wins. The alternative was deleting the old name and keeping_appliedeverywhere, which costs the same churn while leaving a worse name on the surface forever.Supersedes #6951
#6951 added retry loops in
test_trace_sampling_rules_override_envandtest_trace_sampling_rules_override_ratearound post-ACK assertions on_dd.rule_psr/_dd.p.dm, plus the same three manifest unflaggings this PR includes. Those retry loops were a stopgap for the race the unified helper now eliminates deterministically. The retry loops in this PR's converted tests are gone; the manifest changes are the same. #6951 should be closed after this lands. The probabilistic retry insideget_sampled_trace()stays as-is — it handles sampling-by-chance, not the RC race.Local verification
I ran both files five times each against locally installed
ddtracefrom PyPI (prepare-local-build.sh python --method pip).tests/parametric/test_remote_config_apply_endpoint.pytests/parametric/test_dynamic_configuration.pyAll three previously-flagged tests (
test_remote_sampling_rules_retention,test_trace_sampling_rules_override_env,test_trace_sampling_rules_override_rate) ran in the unflagged set and passed every iteration.Workflow
tests/,manifests/,docs/, and one wrapper file inutils/docker_fixtures/. RFC owner review may be appropriate given the parametric harness contract.🛟 #apm-shared-testing 🛟
Reviewer checklist
tests/ormanifests/is modified ? Yes —docs/parametric/remote-config-apply-contract.mdand theAPMLibrarywrapper docstring inutils/docker_fixtures/. The wrapper change is docstring-only. R&P approval if required for the doc-and-docstring change.