Skip to content

Commit 2758272

Browse files
committed
ddtrace: Carry patch 0002 over to version 4.15.3
The crashtracker patch applies unchanged; also drop stray whitespace from the rebased 0001.
1 parent a2cd87d commit 2758272

2 files changed

Lines changed: 65 additions & 2 deletions

File tree

‎patches/ddtrace/4.15.3/0001-native-build-the-OTel-thread-context-only-where-libd.patch‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ index 0bf60ba..03890f6 100644
149149
@@ -82,7 +82,8 @@ if __name__ == "__main__":
150150
# Skip the test for 32-bit Linux systems
151151
print("Skipping test, 32-bit DDWAF not ready yet")
152-
152+
153153
- if platform.system() == "Linux":
154154
+ # libdatadog exports otel_thread_ctx_v1 on x86_64 and aarch64 only.
155155
+ if platform.system() == "Linux" and platform.machine() in ("x86_64", "aarch64"):
156156
from ddtrace.internal.native import _native
157-
157+
158158
print("Running OTel thread context symbol smoke test...")
159159
--
160160
2.50.1 (Apple Git-155)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
From f9b171d23f881c9bf35e4c42221579f948c38d7 Mon Sep 17 00:00:00 2001
2+
From: Ludovic Henry <git@ludovic.dev>
3+
Date: Wed, 26 Aug 2026 15:37:18 +0200
4+
Subject: [PATCH] setup.py: build the crashtracker only where libdatadog
5+
supports it
6+
MIME-Version: 1.0
7+
Content-Type: text/plain; charset=UTF-8
8+
Content-Transfer-Encoding: 8bit
9+
10+
The `crashtracker` feature of src/native pulls in libdd-crashtracker,
11+
which cannot compile outside x86_64/aarch64 on Linux:
12+
13+
* it depends unconditionally (for `cfg(target_os = "linux")`) on
14+
libdd-libunwind-sys, whose build script picks the libunwind
15+
per-architecture static library from `#[cfg(target_arch)]` arms that
16+
exist for x86_64 and aarch64 only, leaving `arch` undefined
17+
elsewhere;
18+
* collector/emitters.rs reads the crash-time register state out of
19+
`ucontext_t` through the same two-arm `#[cfg(target_arch)]` pattern,
20+
with no fallback.
21+
22+
Gate the feature on the architectures libdatadog actually implements.
23+
ddtrace already treats the native crashtracker bindings as optional —
24+
`ddtrace/internal/core/crashtracking.py` sets `is_available = False` when
25+
the import fails, and `_check_for_crashtracking_available()` does the
26+
same — so nothing else needs changing: the wheel simply reports
27+
crashtracking as unavailable.
28+
29+
Rebased onto 4.15.0: upstream raised the Python-version ceiling on the
30+
surrounding `rust_features` gate from `sys.version_info < (3, 15)` to
31+
`< (3, 16)`; unrelated to this change.
32+
33+
Upstream-Status: To upstream [blocked on riscv64 unwinding/ucontext support in libdatadog's libdd-crashtracker]
34+
35+
Signed-off-by: Ludovic Henry <git@ludovic.dev>
36+
---
37+
setup.py | 7 ++++++-
38+
1 file changed, 6 insertions(+), 1 deletion(-)
39+
40+
diff --git a/setup.py b/setup.py
41+
index 393145b..56d1156 100644
42+
--- a/setup.py
43+
+++ b/setup.py
44+
@@ -314,10 +314,15 @@ def is_64_bit_python():
45+
return sys.maxsize > (1 << 32)
46+
47+
48+
+# libdatadog's crashtracker unwinds through libdd-libunwind-sys and reads the
49+
+# signal ucontext register by register, both of which it implements for x86_64
50+
+# and aarch64 only.
51+
+CRASHTRACKER_ARCHS = ("AMD64", "aarch64", "arm64", "x86_64")
52+
+
53+
rust_features = ["stats"]
54+
if CURRENT_OS in ("Linux", "Darwin") and is_64_bit_python() and sys.version_info < (3, 16):
55+
rust_features.append("profiling")
56+
- if not SERVERLESS_BUILD:
57+
+ if not SERVERLESS_BUILD and platform.machine() in CRASHTRACKER_ARCHS:
58+
rust_features.append("crashtracker")
59+
if not SERVERLESS_BUILD:
60+
rust_features.append("ffe")
61+
--
62+
2.50.1 (Apple Git-155)
63+

0 commit comments

Comments
 (0)