Skip to content

Commit f560ac2

Browse files
authored
Propagate agent configured timeout to sidecar (#4025)
* Propagate agent configured timeout to sidecar And make two RC tests more resilient to race conditions * Set low timeouts in tests accessing invalid urls * Increase default timeout a bit * Increase default timeout a bit more, for sidecar only * Try more elaborate unix socket proxy
1 parent 5c9fffc commit f560ac2

37 files changed

Lines changed: 292 additions & 45 deletions

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ TRACER_SOURCES_INI := -d datadog.trace.sources_path=$(TRACER_SOURCE_DIR)
4444
RUN_TESTS_IS_PARALLEL ?= $(shell test $(PHP_MAJOR_MINOR) -ge 74 && echo 1)
4545

4646
# shuffle parallel tests to evenly distribute test load, avoiding a batch of 32 tests being request-replayer tests
47-
RUN_TESTS_CMD := DD_SERVICE= DD_ENV= DD_TRACE_RETRY_INTERVAL=1 REPORT_EXIT_STATUS=1 TEST_PHP_SRCDIR=$(PROJECT_ROOT) USE_TRACKED_ALLOC=1 php -n -d 'memory_limit=-1' $(BUILD_DIR)/run-tests.php $(if $(QUIET_TESTS),,-g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP) $(if $(ASAN), --asan) --show-diff -n -p $(shell which php) -q $(if $(RUN_TESTS_IS_PARALLEL), --shuffle -j$(MAX_TEST_PARALLELISM))
47+
RUN_TESTS_CMD := DD_SERVICE= DD_ENV= REPORT_EXIT_STATUS=1 TEST_PHP_SRCDIR=$(PROJECT_ROOT) USE_TRACKED_ALLOC=1 php -n -d 'memory_limit=-1' $(BUILD_DIR)/run-tests.php $(if $(QUIET_TESTS),,-g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP) $(if $(ASAN), --asan) --show-diff -n -p $(shell which php) -q $(if $(RUN_TESTS_IS_PARALLEL), --shuffle -j$(MAX_TEST_PARALLELISM))
4848

4949
C_FILES = $(shell find components components-rs ext src/dogstatsd tracer zend_abstract_interface -name '*.c' -o -name '*.h' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' )
5050
TEST_FILES = $(shell find tests/ext -name '*.php*' -o -name '*.inc' -o -name '*.json' -o -name '*.yaml' -o -name 'CONFLICTS' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' )
@@ -211,7 +211,7 @@ test_extension_ci: $(SO_FILE) $(TEST_FILES) $(TEST_STUB_FILES) $(BUILD_DIR)/run-
211211
\
212212
export TEST_PHP_JUNIT=$(JUNIT_RESULTS_DIR)/valgrind-extension-test.xml; \
213213
export TEST_PHP_OUTPUT=$(JUNIT_RESULTS_DIR)/valgrind-run-tests.out; \
214-
DD_SPAWN_WORKER_STABLE_TRAMPOLINE=1 $(ALL_TEST_ENV_OVERRIDE) $(RUN_TESTS_CMD) -d extension=$(SO_FILE) -m -s $$TEST_PHP_OUTPUT $(BUILD_DIR)/$(TESTS) && ! grep -e '^LEAKED TEST SUMMARY' $$TEST_PHP_OUTPUT; \
214+
DD_SPAWN_WORKER_STABLE_TRAMPOLINE=1 $(ALL_TEST_ENV_OVERRIDE) DD_TRACE_AGENT_TIMEOUT=5000 $(RUN_TESTS_CMD) -d extension=$(SO_FILE) -m -s $$TEST_PHP_OUTPUT $(BUILD_DIR)/$(TESTS) && ! grep -e '^LEAKED TEST SUMMARY' $$TEST_PHP_OUTPUT; \
215215
)
216216

217217
build_tea: TEA_BUILD_TESTS=ON

ext/configuration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ enum datadog_sidecar_connection_mode {
2828
* A user hit an issue with the userland time of 100.
2929
*/
3030
#define DD_TRACE_AGENT_CONNECT_TIMEOUT_VAL 100
31-
#define DD_TRACE_AGENT_TIMEOUT_VAL 500
31+
#define DD_TRACE_AGENT_TIMEOUT_VAL 3000
3232
#define DD_TRACE_AGENT_FLUSH_INTERVAL_VAL 1001
3333

3434
#define DD_CFG_STR(str) #str

ext/sidecar.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@ ddog_Endpoint *datadog_sidecar_agent_endpoint(void) {
616616

617617
if (agent_endpoint) {
618618
dd_set_endpoint_test_token(agent_endpoint);
619+
ddog_endpoint_set_timeout(agent_endpoint, get_global_DD_TRACE_AGENT_TIMEOUT());
619620
}
620621

621622
return agent_endpoint;

metadata/supported-configurations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,9 +800,9 @@
800800
],
801801
"DD_TRACE_AGENT_TIMEOUT": [
802802
{
803-
"implementation": "B",
803+
"implementation": "C",
804804
"type": "int",
805-
"default": "500"
805+
"default": "3000"
806806
}
807807
],
808808
"DD_TRACE_AGENT_URL": [

tests/ext/appsec/sca_flag_is_sent_01.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ require __DIR__ . '/../includes/clear_skipif_telemetry.inc'
1212
--ENV--
1313
DD_TRACE_GENERATE_ROOT_SPAN=0
1414
DD_INSTRUMENTATION_TELEMETRY_ENABLED=1
15+
DD_TRACE_AGENT_TIMEOUT=200
16+
DD_TRACE_RETRY_INTERVAL=1
1517
--INI--
1618
datadog.trace.agent_url="file://{PWD}/sca_flag_is_sent_01-telemetry.out"
1719
--FILE_EXTERNAL--

tests/ext/appsec/sca_flag_is_sent_02.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ require __DIR__ . '/../includes/clear_skipif_telemetry.inc'
1313
DD_TRACE_GENERATE_ROOT_SPAN=0
1414
DD_INSTRUMENTATION_TELEMETRY_ENABLED=1
1515
DD_APPSEC_SCA_ENABLED=true
16+
DD_TRACE_AGENT_TIMEOUT=200
17+
DD_TRACE_RETRY_INTERVAL=1
1618
--INI--
1719
datadog.trace.agent_url="file://{PWD}/sca_flag_is_sent_02-telemetry.out"
1820
--FILE_EXTERNAL--

tests/ext/appsec/sca_flag_is_sent_03.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ require __DIR__ . '/../includes/clear_skipif_telemetry.inc'
1313
DD_TRACE_GENERATE_ROOT_SPAN=0
1414
DD_INSTRUMENTATION_TELEMETRY_ENABLED=1
1515
DD_APPSEC_SCA_ENABLED=false
16+
DD_TRACE_AGENT_TIMEOUT=200
17+
DD_TRACE_RETRY_INTERVAL=1
1618
--INI--
1719
datadog.trace.agent_url="file://{PWD}/sca_flag_is_sent_03-telemetry.out"
1820
--FILE_EXTERNAL--

tests/ext/appsec/sca_flag_is_sent_04.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ require __DIR__ . '/../includes/clear_skipif_telemetry.inc'
1212
--ENV--
1313
DD_TRACE_GENERATE_ROOT_SPAN=0
1414
DD_INSTRUMENTATION_TELEMETRY_ENABLED=1
15+
DD_TRACE_AGENT_TIMEOUT=200
16+
DD_TRACE_RETRY_INTERVAL=1
1517
--INI--
1618
datadog.trace.agent_url="file://{PWD}/sca_flag_is_sent_04-telemetry.out"
1719
datadog.appsec.sca_enabled=1

tests/ext/appsec/sca_flag_is_sent_05.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ require __DIR__ . '/../includes/clear_skipif_telemetry.inc'
1212
--ENV--
1313
DD_TRACE_GENERATE_ROOT_SPAN=0
1414
DD_INSTRUMENTATION_TELEMETRY_ENABLED=1
15+
DD_TRACE_AGENT_TIMEOUT=200
16+
DD_TRACE_RETRY_INTERVAL=1
1517
--INI--
1618
datadog.trace.agent_url="file://{PWD}/sca_flag_is_sent_05-telemetry.out"
1719
datadog.appsec.sca_enabled=0

tests/ext/background-sender/agent_headers_unix_domain_socket.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ $proxy = RequestReplayer::launchUnixProxy(str_replace("unix://", "", getenv("DD_
2525
\DDTrace\start_span();
2626
\DDTrace\close_span();
2727

28+
// ensure the response also is received by the sender first, to avoid retries holding up other tests
29+
dd_trace_internal_fn("synchronous_flush");
30+
2831
echo PHP_EOL;
2932
$headers = $rr->replayHeaders([
3033
'content-type',

0 commit comments

Comments
 (0)