feat(tracer): align C span code with v1-compatible stub API (v2 groundwork)#4046
feat(tracer): align C span code with v1-compatible stub API (v2 groundwork)#4046Leiyks wants to merge 3 commits into
Conversation
Signed-off-by: Alexandre Rulleau <alexandre.rulleau@datadoghq.com>
Signed-off-by: Alexandre Rulleau <alexandre.rulleau@datadoghq.com>
Bring the tracer C code into consistency with the already-rewritten v1-compatible span stub (tracer/ddtrace.stub.php), keeping the v04 wire format byte-identical (libdatadog v1 FFI is not yet available). - Regenerate ddtrace_arginfo.h from the stub; reorder the ddtrace_span_properties / ddtrace_root_span_data / ddtrace_span_stack structs to match the new property declaration order (PHP property offsets are bound to these C struct fields). - Drop SpanEvent/SpanLink JsonSerializable + jsonSerialize(); relocate that logic into serializer.c so the _dd.span_links / events meta blobs are produced with identical bytes. - Make component/spanKind sourced from the new SpanData properties, translated back into meta (span.kind/component) at serialize time so the v04 wire is unchanged. Register the new SpanKind class. - Remove dead code for stub-removed functions and the DD_TRACE_WARN_LEGACY_DD_TRACE config key; complete the userland integration-analytics removal (Integration.php + call sites); delete tests orphaned by removed functions and rewrite the dd_trace_reset helper tests without gutting their coverage. Refs APMLP-1197.
|
Benchmarks [ tracer ]Benchmark execution time: 2026-07-17 14:10:48 Comparing candidate commit 40bbc2f in PR branch Some scenarios are present only in baseline or only in candidate runs. If you didn't create or remove some scenarios in your branch, this maybe a sign of crashed benchmarks 💥💥💥 Scenarios present only in baseline:
Found 5 performance improvements and 10 performance regressions! Performance is the same for 175 metrics, 0 unstable metrics.
|
What & why
Part of APMLP-1197 (dd-trace-php v1/v2 roadmap). The v1-compatible span
stub API (tracer/ddtrace.stub.php) landed earlier on this branch; this
brings the tracer C code into consistency with it. The v04 wire
format is intentionally kept byte-identical — libdatadog's v1 span
FFI is not yet available, so no wire/protocol switch happens here.
Changes
ddtrace_span_properties / ddtrace_root_span_data / ddtrace_span_stack in
span.h to match the new stub property order (offset parity is
ABI-critical — a mismatch is silent data corruption).
relocated the serialization into serializer.c → _dd.span_links / events
meta blobs are byte-identical.
translated back to meta (component / span.kind) at serialize time, so
the wire is unchanged; new SpanKind class registered.
finished the userland integration-analytics removal (Integration.php +
call sites); deleted orphaned tests and rewrote dd_trace_reset helper
tests without weakening coverage.
Deliberate scope decisions
until libdatadog v1 FFI is ready.
slots (to keep offsets correct) but are left unwired for now.
ZEND_ACC_DEPRECATED flags current gen_stub now emits) to match the
committed convention and avoid runtime E_DEPRECATED on hot paths;
reconciling gen_stub output is a separate follow-up.
Testing
Container build clean; 22 span-shape + 26 curl integration + 30
ConfigurationTest tests passing; links/events wire proven byte-identical.
Draft: pending full CI.