Skip to content

Commit bf6cd22

Browse files
committed
fix: revert span limit check from user-facing DDTrace\start_span APIs
DDTrace\start_span() and DDTrace\start_trace_span() are user-facing APIs that intentionally bypass the span limit — the limit applies to auto-instrumentation (hooks) only. Guarding these APIs with ddtrace_tracer_is_limited() broke: - testTracerFlushedWhenSpanLimitExceeded: the test explicitly verifies that user-created spans work even when DD_TRACE_SPANS_LIMIT is hit. - Guzzle integration tests: isolateTracer() uses start_trace_span() internally to create isolated trace contexts; when closed_spans_count accumulated past the limit across PHPUnit tests, no new stack was created and all spans in the isolated test were lost. The curl multi code paths in handlers_curl.c and handlers_curl_php7.c remain fixed (the actual OOM culprit reported in APMS-18744).
1 parent e2a7782 commit bf6cd22

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

ext/ddtrace.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3214,7 +3214,7 @@ static inline void dd_start_span(INTERNAL_FUNCTION_PARAMETERS) {
32143214

32153215
ddtrace_span_data *span;
32163216

3217-
if (get_DD_TRACE_ENABLED() && !ddtrace_tracer_is_limited()) {
3217+
if (get_DD_TRACE_ENABLED()) {
32183218
span = ddtrace_open_span(DDTRACE_USER_SPAN);
32193219
} else {
32203220
span = ddtrace_init_dummy_span();
@@ -3224,7 +3224,7 @@ static inline void dd_start_span(INTERNAL_FUNCTION_PARAMETERS) {
32243224
span->start = (uint64_t)(start_time_seconds * ZEND_NANO_IN_SEC);
32253225
}
32263226

3227-
if (get_DD_TRACE_ENABLED() && !ddtrace_tracer_is_limited()) {
3227+
if (get_DD_TRACE_ENABLED()) {
32283228
ddtrace_observe_opened_span(span);
32293229
}
32303230

@@ -3238,7 +3238,7 @@ PHP_FUNCTION(DDTrace_start_span) {
32383238

32393239
/* {{{ proto string DDTrace\start_trace_span() */
32403240
PHP_FUNCTION(DDTrace_start_trace_span) {
3241-
if (get_DD_TRACE_ENABLED() && !ddtrace_tracer_is_limited()) {
3241+
if (get_DD_TRACE_ENABLED()) {
32423242
ddtrace_span_stack *stack = ddtrace_init_root_span_stack();
32433243
ddtrace_switch_span_stack(stack);
32443244
GC_DELREF(&stack->std); // We don't retain a ref to it, it's now the active_stack

0 commit comments

Comments
 (0)