Skip to content

Commit 509ad2e

Browse files
committed
fix: align Datadog-Client-Computed-Stats header with ddog_agent_has_stats_computation gate
The header was still sent unconditionally based on the INI flag alone in ext/coms.c and ext/auto_flush.c, while serializer.c already gates actual stats computation on ddog_agent_has_stats_computation(). Add the same agent-capability check to both header-emission sites so the header value matches the serializer behaviour and the TRACE_STATS_COMPUTATION_CLIENT_DROP_P0S_FALSE system test passes.
1 parent 9a2b413 commit 509ad2e

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

ext/auto_flush.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "ddshared.h"
1616
#include "standalone_limiter.h"
1717
#include <main/SAPI.h>
18+
#include <components-rs/ddtrace.h>
1819
#include <components-rs/sidecar.h>
1920

2021
ZEND_EXTERN_MODULE_GLOBALS(ddtrace);
@@ -57,7 +58,7 @@ ZEND_RESULT_CODE ddtrace_flush_tracer(bool force_on_startup, bool collect_cycles
5758
.tracer_version = DDOG_CHARSLICE_C_BARE(PHP_DDTRACE_VERSION),
5859
.lang_version = php_version_rt,
5960
.client_computed_top_level = get_DD_TRACE_STATS_COMPUTATION_ENABLED(),
60-
.client_computed_stats = !get_global_DD_APM_TRACING_ENABLED() || get_DD_TRACE_STATS_COMPUTATION_ENABLED(),
61+
.client_computed_stats = !get_global_DD_APM_TRACING_ENABLED() || (get_DD_TRACE_STATS_COMPUTATION_ENABLED() && ddog_agent_has_stats_computation()),
6162
},
6263
.transport = DDTRACE_G(sidecar),
6364
.instance_id = ddtrace_sidecar_instance_id,

ext/coms.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ static struct curl_slist *dd_agent_headers_alloc(void) {
771771
dd_append_header(&list, "Datadog-Meta-Lang-Interpreter", sapi_module.name, strlen(sapi_module.name));
772772
dd_append_header(&list, "Datadog-Meta-Lang-Version", php_version_rt.ptr, php_version_rt.len);
773773
dd_append_header(&list, "Datadog-Meta-Tracer-Version", ZEND_STRL(PHP_DDTRACE_VERSION));
774-
if (!get_global_DD_APM_TRACING_ENABLED() || (ddtrace_sidecar_for_signal && get_global_DD_TRACE_STATS_COMPUTATION_ENABLED())) {
774+
if (!get_global_DD_APM_TRACING_ENABLED() || (ddtrace_sidecar_for_signal && get_global_DD_TRACE_STATS_COMPUTATION_ENABLED() && ddog_agent_has_stats_computation())) {
775775
dd_append_header(&list, "Datadog-Client-Computed-Stats", ZEND_STRL("true"));
776776
}
777777
if (ddtrace_sidecar_for_signal && get_global_DD_TRACE_STATS_COMPUTATION_ENABLED()) {

0 commit comments

Comments
 (0)