diff --git a/.gitlab/build-sidecar.sh b/.gitlab/build-sidecar.sh index 6040ef36026..e9eaa8cb15d 100755 --- a/.gitlab/build-sidecar.sh +++ b/.gitlab/build-sidecar.sh @@ -13,6 +13,15 @@ set -u suffix="${1:-}" +# Install automake/libtool required by libdd-libunwind-sys build.rs (autoreconf step) +if [ "${suffix}" = "-alpine" ]; then + apk add --no-cache automake libtool +elif command -v apt-get &>/dev/null; then + apt-get install -y --no-install-recommends automake libtool +elif command -v yum &>/dev/null; then + yum install -y automake libtool +fi + # Workaround "error: failed to run custom build command for `aws-lc-sys v0.20.0`" if [ "${suffix}" = "-alpine" ]; then cargo install --force --locked bindgen-cli diff --git a/.gitlab/generate-tracer.php b/.gitlab/generate-tracer.php index acefb647380..1334b692b75 100644 --- a/.gitlab/generate-tracer.php +++ b/.gitlab/generate-tracer.php @@ -581,6 +581,9 @@ function before_script_steps($with_docker_auth = false) { foreach ($type_jobs as $target => $versions): foreach ($versions as $major_minor): $sapis = $type == "web" && version_compare($major_minor, "7.2", ">=") ? ["cli-server", "cgi-fcgi", "apache2handler"] : [""]; + if ($target == "test_web_custom" && in_array("cli-server", $sapis)) { + $sapis[] = "fpm-fcgi"; + } foreach ($sapis as $sapi): ?> ": []": diff --git a/Cargo.lock b/Cargo.lock index 6b9ba0c9879..d7f216a1f12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -143,12 +143,6 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" -[[package]] -name = "ascii" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97be891acc47ca214468e09425d02cef3af2c94d0d82081cd02061f996802f14" - [[package]] name = "assert-json-diff" version = "2.0.2" @@ -215,15 +209,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "autocfg" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" -dependencies = [ - "autocfg 1.4.0", -] - [[package]] name = "autocfg" version = "1.4.0" @@ -282,8 +267,8 @@ dependencies = [ "itoa", "matchit", "memchr", - "mime 0.3.17", - "percent-encoding 2.3.1", + "mime", + "percent-encoding", "pin-project-lite", "serde_core", "sync_wrapper", @@ -303,7 +288,7 @@ dependencies = [ "http", "http-body", "http-body-util", - "mime 0.3.17", + "mime", "pin-project-lite", "sync_wrapper", "tower-layer", @@ -319,22 +304,12 @@ dependencies = [ "addr2line", "cfg-if", "libc 0.2.177", - "miniz_oxide", + "miniz_oxide 0.8.3", "object 0.36.7", "rustc-demangle", "windows-targets 0.52.6", ] -[[package]] -name = "base64" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" -dependencies = [ - "byteorder", - "safemem", -] - [[package]] name = "base64" version = "0.21.7" @@ -368,7 +343,7 @@ dependencies = [ "itertools 0.12.1", "lazy_static", "lazycell", - "log 0.4.25", + "log", "prettyplease", "proc-macro2", "quote", @@ -405,15 +380,15 @@ checksum = "a1d084b0137aaa901caf9f1e8b21daa6aa24d41cd806e111335541eff9683bd6" [[package]] name = "blazesym" -version = "0.2.0-rc.5" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95824d1dd4f20b4a4dfa63b72954e81914a718357231468180b30314e85057fa" +checksum = "48ceccc54b9c3e60e5f36b0498908c8c0f87387229cb0e0e5d65a074e00a8ba4" dependencies = [ - "cpp_demangle", + "cpp_demangle 0.5.1", "gimli 0.32.0", "libc 0.2.177", "memmap2", - "miniz_oxide", + "miniz_oxide 0.9.0", "rustc-demangle", ] @@ -530,18 +505,18 @@ dependencies = [ ] [[package]] -name = "buf_redux" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" +name = "build_common" +version = "28.0.3" dependencies = [ - "memchr", - "safemem", + "cbindgen 0.29.0", + "serde", + "serde_json", ] [[package]] name = "build_common" -version = "0.0.1" +version = "28.0.3" +source = "git+https://github.com/DataDog/libdatadog?tag=v28.0.3#29b010af2f7556b6beb29d1b89ed54ce6ff86e1f" dependencies = [ "cbindgen 0.29.0", "serde", @@ -562,9 +537,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.9.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" dependencies = [ "serde", ] @@ -625,7 +600,7 @@ dependencies = [ "clap", "heck 0.4.1", "indexmap 2.12.1", - "log 0.4.25", + "log", "proc-macro2", "quote", "serde", @@ -644,7 +619,7 @@ dependencies = [ "clap", "heck 0.5.0", "indexmap 2.12.1", - "log 0.4.25", + "log", "proc-macro2", "quote", "serde", @@ -716,12 +691,6 @@ dependencies = [ "windows-link 0.1.1", ] -[[package]] -name = "chunked_transfer" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "498d20a7aaf62625b9bf26e637cf7736417cde1d0c99f1d04d1170229a85cf87" - [[package]] name = "ciborium" version = "0.2.2" @@ -800,15 +769,6 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "cmake" version = "0.1.57" @@ -951,6 +911,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "cpp_demangle" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0667304c32ea56cb4cd6d2d7c0cfe9a2f8041229db8c033af7f8d69492429def" +dependencies = [ + "cfg-if", +] + [[package]] name = "cpu-time" version = "1.0.0" @@ -1025,6 +994,12 @@ dependencies = [ "itertools 0.10.5", ] +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + [[package]] name = "crossbeam-channel" version = "0.5.15" @@ -1208,6 +1183,12 @@ dependencies = [ "syn 2.0.96", ] +[[package]] +name = "data-encoding" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" + [[package]] name = "datadog-ffe" version = "1.0.0" @@ -1217,7 +1198,7 @@ dependencies = [ "derive_more", "env_logger 0.10.2", "faststr", - "log 0.4.25", + "log", "md5", "pyo3", "regex", @@ -1226,7 +1207,7 @@ dependencies = [ "serde_json", "serde_with", "thiserror 2.0.12", - "url 2.5.4", + "url", ] [[package]] @@ -1241,7 +1222,7 @@ dependencies = [ "glibc_version", "io-lifetimes", "libc 0.2.177", - "libdd-common 1.1.0", + "libdd-common 2.0.0", "libdd-tinybytes", "memfd", "nix 0.29.0", @@ -1275,14 +1256,15 @@ name = "datadog-live-debugger" version = "0.0.1" dependencies = [ "anyhow", + "bytes", "constcat", + "http", "http-body-util", - "hyper 1.6.0", - "libdd-common 1.1.0", + "libdd-common 2.0.0", "libdd-data-pipeline", - "percent-encoding 2.3.1", + "percent-encoding", "regex", - "regex-automata 0.4.9", + "regex-automata", "serde", "serde_json", "smallvec", @@ -1295,12 +1277,12 @@ dependencies = [ name = "datadog-live-debugger-ffi" version = "0.0.1" dependencies = [ - "build_common", + "build_common 28.0.3", "datadog-live-debugger", - "libdd-common 1.1.0", - "libdd-common-ffi", - "log 0.4.25", - "percent-encoding 2.3.1", + "libdd-common 2.0.0", + "libdd-common-ffi 28.0.3", + "log", + "percent-encoding", "serde_json", "tokio", "tokio-util", @@ -1328,10 +1310,10 @@ dependencies = [ "lazy_static", "libc 0.2.177", "libdd-alloc", - "libdd-common 1.1.0 (git+https://github.com/DataDog/libdatadog?tag=v27.0.0)", - "libdd-library-config-ffi", + "libdd-common 2.0.0 (git+https://github.com/DataDog/libdatadog?tag=v28.0.3)", + "libdd-library-config-ffi 0.0.2 (git+https://github.com/DataDog/libdatadog?tag=v28.0.3)", "libdd-profiling", - "log 0.4.25", + "log", "mach2", "perfcnt", "rand 0.8.5", @@ -1358,17 +1340,17 @@ dependencies = [ "futures-util", "http", "http-body-util", - "hyper 1.6.0", + "hyper", "hyper-util", - "libdd-common 1.1.0", - "libdd-trace-protobuf", + "libdd-common 2.0.0", + "libdd-trace-protobuf 1.1.0", "manual_future", "regex", "serde", "serde_json", "serde_with", "sha2", - "time 0.3.37", + "time", "tokio", "tokio-util", "tracing", @@ -1394,10 +1376,9 @@ dependencies = [ "http", "http-body-util", "httpmock", - "hyper 1.6.0", "libc 0.2.177", - "libdd-common 1.1.0", - "libdd-common-ffi", + "libdd-common 2.0.0", + "libdd-common-ffi 28.0.3", "libdd-crashtracker", "libdd-crashtracker-ffi", "libdd-data-pipeline", @@ -1441,8 +1422,8 @@ dependencies = [ "datadog-sidecar", "http", "libc 0.2.177", - "libdd-common 1.1.0", - "libdd-common-ffi", + "libdd-common 2.0.0", + "libdd-common-ffi 28.0.3", "libdd-crashtracker-ffi", "libdd-dogstatsd-client", "libdd-telemetry", @@ -1484,18 +1465,18 @@ dependencies = [ "itertools 0.11.0", "lazy_static", "libc 0.2.177", - "libdd-common 1.1.0", - "libdd-common-ffi", + "libdd-common 2.0.0", + "libdd-common-ffi 28.0.3", "libdd-crashtracker-ffi", - "libdd-library-config-ffi", + "libdd-library-config-ffi 0.0.2", "libdd-telemetry", "libdd-telemetry-ffi", "libdd-tinybytes", "libdd-trace-utils", - "log 0.4.25", + "log", "paste", "regex", - "regex-automata 0.4.9", + "regex-automata", "serde", "serde_json", "serde_with", @@ -1646,6 +1627,18 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.96", +] + [[package]] name = "enum-ordinalize" version = "3.1.15" @@ -1665,7 +1658,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" dependencies = [ - "log 0.4.25", + "log", ] [[package]] @@ -1676,7 +1669,7 @@ checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" dependencies = [ "humantime", "is-terminal", - "log 0.4.25", + "log", "regex", "termcolor", ] @@ -1688,7 +1681,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0" dependencies = [ "env_filter", - "log 0.4.25", + "log", ] [[package]] @@ -1781,7 +1774,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.8.3", ] [[package]] @@ -1817,7 +1810,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "percent-encoding 2.3.1", + "percent-encoding", ] [[package]] @@ -2033,17 +2026,11 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daa0a64d21a7eb230583b4c5f4e23b7e4e57974f96620f42a7e75e08ae66d745" dependencies = [ - "log 0.4.25", + "log", "plain", "scroll", ] -[[package]] -name = "groupable" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32619942b8be646939eaf3db0602b39f5229b74575b67efc897811ded1db4e57" - [[package]] name = "h2" version = "0.4.8" @@ -2140,7 +2127,7 @@ dependencies = [ "headers-core", "http", "httpdate", - "mime 0.3.17", + "mime", "sha1", ] @@ -2183,6 +2170,52 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hickory-proto" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8a6fe56c0038198998a6f217ca4e7ef3a5e51f46163bd6dd60b5c71ca6c6502" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna", + "ipnet", + "once_cell", + "rand 0.9.0", + "ring", + "thiserror 2.0.12", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "hickory-resolver" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc62a9a99b0bfb44d2ab95a7208ac952d31060efc16241c87eaf36406fecf87a" +dependencies = [ + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "moka", + "once_cell", + "parking_lot", + "rand 0.9.0", + "resolv-conf", + "smallvec", + "thiserror 2.0.12", + "tokio", + "tracing", +] + [[package]] name = "home" version = "0.5.9" @@ -2255,7 +2288,7 @@ dependencies = [ "headers", "http", "http-body-util", - "hyper 1.6.0", + "hyper", "hyper-util", "path-tree", "regex", @@ -2268,7 +2301,7 @@ dependencies = [ "thiserror 2.0.12", "tokio", "tracing", - "url 2.5.4", + "url", ] [[package]] @@ -2277,25 +2310,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" -[[package]] -name = "hyper" -version = "0.10.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" -dependencies = [ - "base64 0.9.3", - "httparse", - "language-tags", - "log 0.3.9", - "mime 0.2.6", - "num_cpus", - "time 0.1.45", - "traitobject", - "typeable", - "unicase 1.4.2", - "url 1.7.2", -] - [[package]] name = "hyper" version = "1.6.0" @@ -2325,7 +2339,7 @@ checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" dependencies = [ "futures-util", "http", - "hyper 1.6.0", + "hyper", "hyper-util", "rustls", "rustls-native-certs", @@ -2342,7 +2356,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" dependencies = [ - "hyper 1.6.0", + "hyper", "hyper-util", "pin-project-lite", "tokio", @@ -2362,10 +2376,10 @@ dependencies = [ "futures-util", "http", "http-body", - "hyper 1.6.0", + "hyper", "ipnet", "libc 0.2.177", - "percent-encoding 2.3.1", + "percent-encoding", "pin-project-lite", "socket2 0.5.10", "tokio", @@ -2520,17 +2534,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "1.0.3" @@ -2558,7 +2561,7 @@ version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ - "autocfg 1.4.0", + "autocfg", "hashbrown 0.12.3", "serde", ] @@ -2601,6 +2604,18 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "ipconfig" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" +dependencies = [ + "socket2 0.5.10", + "widestring", + "windows-sys 0.48.0", + "winreg", +] + [[package]] name = "ipnet" version = "2.11.0" @@ -2617,22 +2632,6 @@ dependencies = [ "serde", ] -[[package]] -name = "iron" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6d308ca2d884650a8bf9ed2ff4cb13fbb2207b71f64cda11dc9b892067295e8" -dependencies = [ - "hyper 0.10.16", - "log 0.3.9", - "mime_guess 1.8.8", - "modifier", - "num_cpus", - "plugin", - "typemap", - "url 1.7.2", -] - [[package]] name = "is-terminal" version = "0.4.13" @@ -2693,7 +2692,7 @@ dependencies = [ "cfg-if", "combine", "jni-sys", - "log 0.4.25", + "log", "thiserror 1.0.69", "walkdir", "windows-sys 0.45.0", @@ -2734,12 +2733,6 @@ dependencies = [ "winapi-build", ] -[[package]] -name = "language-tags" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" - [[package]] name = "lazy_static" version = "1.4.0" @@ -2767,7 +2760,7 @@ checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] name = "libdd-alloc" version = "1.0.0" -source = "git+https://github.com/DataDog/libdatadog?tag=v27.0.0#72e56a3dcf9189a92db1f177c4c9d844725079f7" +source = "git+https://github.com/DataDog/libdatadog?tag=v28.0.3#29b010af2f7556b6beb29d1b89ed54ce6ff86e1f" dependencies = [ "allocator-api2", "libc 0.2.177", @@ -2776,7 +2769,7 @@ dependencies = [ [[package]] name = "libdd-common" -version = "1.1.0" +version = "2.0.0" dependencies = [ "anyhow", "bytes", @@ -2790,13 +2783,13 @@ dependencies = [ "http-body", "http-body-util", "httparse", - "hyper 1.6.0", + "hyper", "hyper-rustls", "hyper-util", "indexmap 2.12.1", "libc 0.2.177", "maplit", - "mime 0.3.17", + "mime", "multer", "nix 0.29.0", "pin-project", @@ -2805,6 +2798,7 @@ dependencies = [ "reqwest", "rustls", "rustls-native-certs", + "rusty-fork", "serde", "static_assertions", "tempfile", @@ -2817,10 +2811,11 @@ dependencies = [ [[package]] name = "libdd-common" -version = "1.1.0" -source = "git+https://github.com/DataDog/libdatadog?tag=v27.0.0#72e56a3dcf9189a92db1f177c4c9d844725079f7" +version = "2.0.0" +source = "git+https://github.com/DataDog/libdatadog?tag=v28.0.3#29b010af2f7556b6beb29d1b89ed54ce6ff86e1f" dependencies = [ "anyhow", + "bytes", "cc", "const_format", "futures", @@ -2831,12 +2826,12 @@ dependencies = [ "http-body", "http-body-util", "httparse", - "hyper 1.6.0", + "hyper", "hyper-rustls", "hyper-util", "libc 0.2.177", - "mime 0.3.17", - "multipart", + "mime", + "multer", "nix 0.29.0", "pin-project", "rand 0.8.5", @@ -2855,17 +2850,31 @@ dependencies = [ [[package]] name = "libdd-common-ffi" -version = "0.0.1" +version = "28.0.3" dependencies = [ "anyhow", "assert_no_alloc", "bolero", - "build_common", + "build_common 28.0.3", "chrono", "crossbeam-queue", "function_name", - "hyper 1.6.0", - "libdd-common 1.1.0", + "hyper", + "libdd-common 2.0.0", + "serde", +] + +[[package]] +name = "libdd-common-ffi" +version = "28.0.3" +source = "git+https://github.com/DataDog/libdatadog?tag=v28.0.3#29b010af2f7556b6beb29d1b89ed54ce6ff86e1f" +dependencies = [ + "anyhow", + "build_common 28.0.3 (git+https://github.com/DataDog/libdatadog?tag=v28.0.3)", + "chrono", + "crossbeam-queue", + "hyper", + "libdd-common 2.0.0 (git+https://github.com/DataDog/libdatadog?tag=v28.0.3)", "serde", ] @@ -2874,7 +2883,6 @@ name = "libdd-crashtracker" version = "1.0.0" dependencies = [ "anyhow", - "backtrace", "blazesym", "cc", "chrono", @@ -2884,7 +2892,8 @@ dependencies = [ "goblin", "http", "libc 0.2.177", - "libdd-common 1.1.0", + "libdd-common 2.0.0", + "libdd-libunwind-sys", "libdd-telemetry", "nix 0.29.0", "num-derive", @@ -2907,14 +2916,14 @@ dependencies = [ [[package]] name = "libdd-crashtracker-ffi" -version = "0.0.1" +version = "28.0.3" dependencies = [ "anyhow", - "build_common", + "build_common 28.0.3", "function_name", "libc 0.2.177", - "libdd-common 1.1.0", - "libdd-common-ffi", + "libdd-common 2.0.0", + "libdd-common-ffi 28.0.3", "libdd-crashtracker", "serde", "serde_json", @@ -2926,7 +2935,7 @@ dependencies = [ [[package]] name = "libdd-data-pipeline" -version = "1.0.0" +version = "2.0.0" dependencies = [ "anyhow", "arc-swap", @@ -2937,15 +2946,13 @@ dependencies = [ "http", "http-body-util", "httpmock", - "hyper 1.6.0", - "hyper-util", - "libdd-common 1.1.0", + "libdd-common 2.0.0", "libdd-ddsketch", "libdd-dogstatsd-client", "libdd-log", "libdd-telemetry", "libdd-tinybytes", - "libdd-trace-protobuf", + "libdd-trace-protobuf 1.1.0", "libdd-trace-stats", "libdd-trace-utils", "rand 0.8.5", @@ -2963,7 +2970,7 @@ dependencies = [ [[package]] name = "libdd-ddsketch" -version = "1.0.0" +version = "1.0.1" dependencies = [ "prost", "prost-build", @@ -2972,12 +2979,12 @@ dependencies = [ [[package]] name = "libdd-dogstatsd-client" -version = "1.0.0" +version = "1.0.1" dependencies = [ "anyhow", "cadence", "http", - "libdd-common 1.1.0", + "libdd-common 2.0.0", "serde", "tokio", "tracing", @@ -2988,28 +2995,71 @@ name = "libdd-library-config" version = "1.0.0" dependencies = [ "anyhow", + "libdd-trace-protobuf 1.1.0", "memfd", + "prost", "rand 0.8.5", "rmp", "rmp-serde", + "rustix 1.1.3", "serde", "serde_yaml", + "serial_test", "tempfile", ] +[[package]] +name = "libdd-library-config" +version = "1.0.0" +source = "git+https://github.com/DataDog/libdatadog?tag=v28.0.3#29b010af2f7556b6beb29d1b89ed54ce6ff86e1f" +dependencies = [ + "anyhow", + "libdd-trace-protobuf 1.1.0 (git+https://github.com/DataDog/libdatadog?tag=v28.0.3)", + "memfd", + "prost", + "rand 0.8.5", + "rmp", + "rmp-serde", + "rustix 1.1.3", + "serde", + "serde_yaml", +] + [[package]] name = "libdd-library-config-ffi" version = "0.0.2" dependencies = [ "anyhow", - "build_common", + "build_common 28.0.3", "constcat", - "libdd-common 1.1.0", - "libdd-common-ffi", - "libdd-library-config", + "libdd-common 2.0.0", + "libdd-common-ffi 28.0.3", + "libdd-library-config 1.0.0", "tempfile", ] +[[package]] +name = "libdd-library-config-ffi" +version = "0.0.2" +source = "git+https://github.com/DataDog/libdatadog?tag=v28.0.3#29b010af2f7556b6beb29d1b89ed54ce6ff86e1f" +dependencies = [ + "anyhow", + "build_common 28.0.3 (git+https://github.com/DataDog/libdatadog?tag=v28.0.3)", + "constcat", + "libdd-common 2.0.0 (git+https://github.com/DataDog/libdatadog?tag=v28.0.3)", + "libdd-common-ffi 28.0.3 (git+https://github.com/DataDog/libdatadog?tag=v28.0.3)", + "libdd-library-config 1.0.0 (git+https://github.com/DataDog/libdatadog?tag=v28.0.3)", +] + +[[package]] +name = "libdd-libunwind-sys" +version = "28.0.3" +dependencies = [ + "cc", + "libc 0.2.177", + "paste", +] + [[package]] name = "libdd-log" version = "1.0.0" @@ -3024,7 +3074,7 @@ dependencies = [ [[package]] name = "libdd-profiling" version = "1.0.0" -source = "git+https://github.com/DataDog/libdatadog?tag=v27.0.0#72e56a3dcf9189a92db1f177c4c9d844725079f7" +source = "git+https://github.com/DataDog/libdatadog?tag=v28.0.3#29b010af2f7556b6beb29d1b89ed54ce6ff86e1f" dependencies = [ "allocator-api2", "anyhow", @@ -3041,14 +3091,16 @@ dependencies = [ "httparse", "indexmap 2.12.1", "libdd-alloc", - "libdd-common 1.1.0 (git+https://github.com/DataDog/libdatadog?tag=v27.0.0)", + "libdd-common 2.0.0 (git+https://github.com/DataDog/libdatadog?tag=v28.0.3)", "libdd-profiling-protobuf", - "mime 0.3.17", + "mime", "parking_lot", "prost", "rand 0.8.5", "reqwest", "rustc-hash 1.1.0", + "rustls", + "rustls-platform-verifier", "serde", "serde_json", "target-triple", @@ -3061,14 +3113,14 @@ dependencies = [ [[package]] name = "libdd-profiling-protobuf" version = "1.0.0" -source = "git+https://github.com/DataDog/libdatadog?tag=v27.0.0#72e56a3dcf9189a92db1f177c4c9d844725079f7" +source = "git+https://github.com/DataDog/libdatadog?tag=v28.0.3#29b010af2f7556b6beb29d1b89ed54ce6ff86e1f" dependencies = [ "prost", ] [[package]] name = "libdd-telemetry" -version = "2.0.0" +version = "3.0.0" dependencies = [ "anyhow", "base64 0.22.1", @@ -3076,10 +3128,8 @@ dependencies = [ "hashbrown 0.15.2", "http", "http-body-util", - "hyper 1.6.0", - "hyper-util", "libc 0.2.177", - "libdd-common 1.1.0", + "libdd-common 2.0.0", "libdd-ddsketch", "serde", "serde_json", @@ -3094,13 +3144,13 @@ dependencies = [ [[package]] name = "libdd-telemetry-ffi" -version = "0.0.1" +version = "28.0.3" dependencies = [ - "build_common", + "build_common 28.0.3", "function_name", "libc 0.2.177", - "libdd-common 1.1.0", - "libdd-common-ffi", + "libdd-common 2.0.0", + "libdd-common-ffi 28.0.3", "libdd-telemetry", "paste", "tempfile", @@ -3122,19 +3172,19 @@ dependencies = [ [[package]] name = "libdd-trace-normalization" -version = "1.0.0" +version = "1.0.1" dependencies = [ "anyhow", "arbitrary", "criterion", "duplicate", - "libdd-trace-protobuf", + "libdd-trace-protobuf 1.1.0", "rand 0.8.5", ] [[package]] name = "libdd-trace-protobuf" -version = "1.0.0" +version = "1.1.0" dependencies = [ "prost", "prost-build", @@ -3145,21 +3195,31 @@ dependencies = [ "tokio", ] +[[package]] +name = "libdd-trace-protobuf" +version = "1.1.0" +source = "git+https://github.com/DataDog/libdatadog?tag=v28.0.3#29b010af2f7556b6beb29d1b89ed54ce6ff86e1f" +dependencies = [ + "prost", + "serde", + "serde_bytes", +] + [[package]] name = "libdd-trace-stats" -version = "1.0.0" +version = "1.0.1" dependencies = [ "criterion", "hashbrown 0.15.2", "libdd-ddsketch", - "libdd-trace-protobuf", + "libdd-trace-protobuf 1.1.0", "libdd-trace-utils", "rand 0.8.5", ] [[package]] name = "libdd-trace-utils" -version = "1.0.0" +version = "2.0.0" dependencies = [ "anyhow", "bolero", @@ -3170,14 +3230,15 @@ dependencies = [ "flate2", "futures", "http", + "http-body", "http-body-util", "httpmock", - "hyper 1.6.0", + "hyper", "indexmap 2.12.1", - "libdd-common 1.1.0", + "libdd-common 2.0.0", "libdd-tinybytes", "libdd-trace-normalization", - "libdd-trace-protobuf", + "libdd-trace-protobuf 1.1.0", "libdd-trace-utils", "prost", "rand 0.8.5", @@ -3242,19 +3303,10 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ - "autocfg 1.4.0", + "autocfg", "scopeguard", ] -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -dependencies = [ - "log 0.4.25", -] - [[package]] name = "log" version = "0.4.25" @@ -3297,19 +3349,13 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] name = "matchers" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" dependencies = [ - "regex-automata 0.1.10", + "regex-automata", ] -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - [[package]] name = "matchit" version = "0.8.4" @@ -3352,7 +3398,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ - "autocfg 1.4.0", + "autocfg", ] [[package]] @@ -3376,41 +3422,20 @@ dependencies = [ "windows-sys 0.42.0", ] -[[package]] -name = "mime" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" -dependencies = [ - "log 0.3.9", -] - [[package]] name = "mime" version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "mime_guess" -version = "1.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216929a5ee4dd316b1702eedf5e74548c123d370f47841ceaac38ca154690ca3" -dependencies = [ - "mime 0.2.6", - "phf 0.7.24", - "phf_codegen 0.7.24", - "unicase 1.4.2", -] - [[package]] name = "mime_guess" version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" dependencies = [ - "mime 0.3.17", - "unicase 2.8.1", + "mime", + "unicase", ] [[package]] @@ -3424,6 +3449,15 @@ name = "miniz_oxide" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8402cab7aefae129c6977bb0ff1b8fd9a04eb5b51efc50a70bea51cda0c7924" +dependencies = [ + "adler2", +] + +[[package]] +name = "miniz_oxide" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5faa9f23e86bd5768d76def086192ff5f869fb088da12a976ea21e9796b975f6" dependencies = [ "adler2", "simd-adler32", @@ -3451,10 +3485,21 @@ dependencies = [ ] [[package]] -name = "modifier" -version = "0.1.0" +name = "moka" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58" +checksum = "85f8024e1c8e71c778968af91d43700ce1d11b219d127d79fb2934153b82b42b" +dependencies = [ + "crossbeam-channel", + "crossbeam-epoch", + "crossbeam-utils", + "equivalent", + "parking_lot", + "portable-atomic", + "smallvec", + "tagptr", + "uuid", +] [[package]] name = "msvc-demangler" @@ -3477,7 +3522,7 @@ dependencies = [ "http", "httparse", "memchr", - "mime 0.3.17", + "mime", "spin", "version_check 0.9.5", ] @@ -3488,59 +3533,6 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" -[[package]] -name = "multipart" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00dec633863867f29cb39df64a397cdf4a6354708ddd7759f70c7fb51c5f9182" -dependencies = [ - "buf_redux", - "httparse", - "hyper 0.10.16", - "iron", - "log 0.4.25", - "mime 0.3.17", - "mime_guess 2.0.5", - "nickel", - "quick-error", - "rand 0.8.5", - "safemem", - "tempfile", - "tiny_http", - "twoway", -] - -[[package]] -name = "mustache" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51956ef1c5d20a1384524d91e616fb44dfc7d8f249bf696d49c97dd3289ecab5" -dependencies = [ - "log 0.3.9", - "serde", -] - -[[package]] -name = "nickel" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5061a832728db2dacb61cefe0ce303b58f85764ec680e71d9138229640a46d9" -dependencies = [ - "groupable", - "hyper 0.10.16", - "lazy_static", - "log 0.3.9", - "modifier", - "mustache", - "plugin", - "regex", - "serde", - "serde_json", - "time 0.1.45", - "typemap", - "url 1.7.2", -] - [[package]] name = "nix" version = "0.29.0" @@ -3588,12 +3580,11 @@ dependencies = [ [[package]] name = "nu-ansi-term" -version = "0.46.0" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "overload", - "winapi 0.3.9", + "windows-sys 0.61.2", ] [[package]] @@ -3638,7 +3629,7 @@ version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ - "autocfg 1.4.0", + "autocfg", "libm", ] @@ -3836,6 +3827,10 @@ name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +dependencies = [ + "critical-section", + "portable-atomic", +] [[package]] name = "oorandom" @@ -3862,7 +3857,7 @@ dependencies = [ "futures-util", "js-sys", "lazy_static", - "percent-encoding 2.3.1", + "percent-encoding", "pin-project", "rand 0.8.5", "thiserror 1.0.69", @@ -3910,7 +3905,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4022a17595a00d6a369236fdae483f0de7f0a339960a53118b818238e132224" dependencies = [ "android_system_properties", - "log 0.4.25", + "log", "nix 0.30.1", "objc2", "objc2-foundation", @@ -3919,12 +3914,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "page_size" version = "0.6.0" @@ -3979,12 +3968,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - [[package]] name = "percent-encoding" version = "2.3.1" @@ -4015,32 +3998,13 @@ dependencies = [ "indexmap 2.12.1", ] -[[package]] -name = "phf" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18" -dependencies = [ - "phf_shared 0.7.24", -] - [[package]] name = "phf" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ac8b67553a7ca9457ce0e526948cad581819238f4a9d1ea74545851fa24f37" dependencies = [ - "phf_shared 0.9.0", -] - -[[package]] -name = "phf_codegen" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e" -dependencies = [ - "phf_generator 0.7.24", - "phf_shared 0.7.24", + "phf_shared", ] [[package]] @@ -4049,18 +4013,8 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "963adb11cf22ee65dfd401cf75577c1aa0eca58c0b97f9337d2da61d3e640503" dependencies = [ - "phf_generator 0.9.1", - "phf_shared 0.9.0", -] - -[[package]] -name = "phf_generator" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" -dependencies = [ - "phf_shared 0.7.24", - "rand 0.6.5", + "phf_generator", + "phf_shared", ] [[package]] @@ -4069,27 +4023,17 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d43f3220d96e0080cc9ea234978ccd80d904eafb17be31bb0f76daaea6493082" dependencies = [ - "phf_shared 0.9.0", + "phf_shared", "rand 0.8.5", ] -[[package]] -name = "phf_shared" -version = "0.7.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" -dependencies = [ - "siphasher 0.2.3", - "unicase 1.4.2", -] - [[package]] name = "phf_shared" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a68318426de33640f02be62b4ae8eb1261be2efbc337b60c54d845bf4484e0d9" dependencies = [ - "siphasher 0.3.11", + "siphasher", ] [[package]] @@ -4173,15 +4117,6 @@ dependencies = [ "plotters-backend", ] -[[package]] -name = "plugin" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a6a0dc3910bc8db877ffed8e457763b317cf880df4ae19109b9f77d277cf6e0" -dependencies = [ - "typemap", -] - [[package]] name = "portable-atomic" version = "1.10.0" @@ -4248,7 +4183,7 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "714c75db297bc88a63783ffc6ab9f830698a6705aa0201416931759ef4c8183d" dependencies = [ - "autocfg 1.4.0", + "autocfg", "equivalent", "indexmap 2.12.1", ] @@ -4306,8 +4241,8 @@ dependencies = [ "num-traits", "rand 0.8.5", "rand_chacha 0.3.1", - "rand_xorshift 0.3.0", - "regex-syntax 0.8.5", + "rand_xorshift", + "regex-syntax", "unarray", ] @@ -4329,7 +4264,7 @@ checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7" dependencies = [ "heck 0.5.0", "itertools 0.12.1", - "log 0.4.25", + "log", "multimap", "petgraph", "prettyplease", @@ -4570,25 +4505,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "rand" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" -dependencies = [ - "autocfg 0.1.8", - "libc 0.2.177", - "rand_chacha 0.1.1", - "rand_core 0.4.2", - "rand_hc", - "rand_isaac", - "rand_jitter", - "rand_os", - "rand_pcg", - "rand_xorshift 0.1.1", - "winapi 0.3.9", -] - [[package]] name = "rand" version = "0.8.5" @@ -4611,16 +4527,6 @@ dependencies = [ "zerocopy 0.8.24", ] -[[package]] -name = "rand_chacha" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" -dependencies = [ - "autocfg 0.1.8", - "rand_core 0.3.1", -] - [[package]] name = "rand_chacha" version = "0.3.1" @@ -4684,68 +4590,6 @@ dependencies = [ "rand 0.8.5", ] -[[package]] -name = "rand_hc" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rand_isaac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rand_jitter" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" -dependencies = [ - "libc 0.2.177", - "rand_core 0.4.2", - "winapi 0.3.9", -] - -[[package]] -name = "rand_os" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc 0.2.177", - "rand_core 0.4.2", - "rdrand", - "winapi 0.3.9", -] - -[[package]] -name = "rand_pcg" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" -dependencies = [ - "autocfg 0.1.8", - "rand_core 0.4.2", -] - -[[package]] -name = "rand_xorshift" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "rand_xorshift" version = "0.3.0" @@ -4839,17 +4683,8 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", + "regex-automata", + "regex-syntax", ] [[package]] @@ -4860,15 +4695,9 @@ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.5" @@ -4894,16 +4723,18 @@ dependencies = [ "bytes", "futures-core", "futures-util", + "hickory-resolver", "http", "http-body", "http-body-util", - "hyper 1.6.0", + "hyper", "hyper-rustls", "hyper-util", "js-sys", - "log 0.4.25", - "mime_guess 2.0.5", - "percent-encoding 2.3.1", + "log", + "mime_guess", + "once_cell", + "percent-encoding", "pin-project-lite", "quinn", "rustls", @@ -4915,12 +4746,18 @@ dependencies = [ "tower", "tower-http", "tower-service", - "url 2.5.4", + "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", ] +[[package]] +name = "resolv-conf" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7" + [[package]] name = "ring" version = "0.17.14" @@ -5075,7 +4912,7 @@ dependencies = [ "core-foundation", "core-foundation-sys", "jni", - "log 0.4.25", + "log", "once_cell", "rustls", "rustls-native-certs", @@ -5111,6 +4948,18 @@ version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" +[[package]] +name = "rusty-fork" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + [[package]] name = "ruzstd" version = "0.3.1" @@ -5128,12 +4977,6 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" -[[package]] -name = "safemem" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" - [[package]] name = "same-file" version = "1.0.6" @@ -5143,6 +4986,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scc" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46e6f046b7fef48e2660c57ed794263155d713de679057f2d0c169bfc6e756cc" +dependencies = [ + "sdd", +] + [[package]] name = "schannel" version = "0.1.27" @@ -5208,6 +5060,12 @@ dependencies = [ "syn 2.0.96", ] +[[package]] +name = "sdd" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "490dcfcbfef26be6800d11870ff2df8774fa6e86d047e3e8c8a76b25655e41ca" + [[package]] name = "security-framework" version = "3.5.1" @@ -5364,7 +5222,7 @@ dependencies = [ "serde_derive", "serde_json", "serde_with_macros", - "time 0.3.37", + "time", ] [[package]] @@ -5392,6 +5250,32 @@ dependencies = [ "unsafe-libyaml", ] +[[package]] +name = "serial_test" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "911bd979bf1070a3f3aa7b691a3b3e9968f339ceeec89e08c280a8a22207a32f" +dependencies = [ + "futures-executor", + "futures-util", + "log", + "once_cell", + "parking_lot", + "scc", + "serial_test_derive", +] + +[[package]] +name = "serial_test_derive" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a7d91949b85b0d2fb687445e448b40d322b6b3e4af6b44a29b21d9a5f33e6d9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", +] + [[package]] name = "sha1" version = "0.10.6" @@ -5478,12 +5362,6 @@ version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa" -[[package]] -name = "siphasher" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" - [[package]] name = "siphasher" version = "0.3.11" @@ -5496,7 +5374,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ - "autocfg 1.4.0", + "autocfg", ] [[package]] @@ -5675,7 +5553,7 @@ version = "12.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98cf6a95abff97de4d7ff3473f33cacd38f1ddccad5c1feab435d6760300e3b6" dependencies = [ - "cpp_demangle", + "cpp_demangle 0.4.4", "msvc-demangler", "rustc-demangle", "symbolic-common", @@ -5742,6 +5620,12 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "tagptr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" + [[package]] name = "target-lexicon" version = "0.13.4" @@ -5920,22 +5804,11 @@ checksum = "b82ca8f46f95b3ce96081fe3dd89160fdea970c254bb72925255d1b62aae692e" dependencies = [ "byteorder", "integer-encoding", - "log 0.4.25", + "log", "ordered-float", "threadpool", ] -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc 0.2.177", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi 0.3.9", -] - [[package]] name = "time" version = "0.3.37" @@ -5967,19 +5840,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tiny_http" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e22cb179b63e5fc2d0b5be237dc107da072e2407809ac70a8ce85b93fe8f562" -dependencies = [ - "ascii", - "chrono", - "chunked_transfer", - "log 0.4.25", - "url 1.7.2", -] - [[package]] name = "tinystr" version = "0.7.6" @@ -6157,10 +6017,10 @@ dependencies = [ "http", "http-body", "http-body-util", - "hyper 1.6.0", + "hyper", "hyper-timeout", "hyper-util", - "percent-encoding 2.3.1", + "percent-encoding", "pin-project", "socket2 0.6.2", "sync_wrapper", @@ -6234,11 +6094,11 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.41" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ - "log 0.4.25", + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -6252,15 +6112,15 @@ checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" dependencies = [ "crossbeam-channel", "thiserror 1.0.69", - "time 0.3.37", + "time", "tracing-subscriber", ] [[package]] name = "tracing-attributes" -version = "0.1.28" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", @@ -6269,9 +6129,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.33" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", "valuable", @@ -6283,7 +6143,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ - "log 0.4.25", + "log", "once_cell", "tracing-core", ] @@ -6313,14 +6173,14 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.19" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" dependencies = [ "matchers", "nu-ansi-term", "once_cell", - "regex", + "regex-automata", "serde", "serde_json", "sharded-slab", @@ -6332,12 +6192,6 @@ dependencies = [ "tracing-serde", ] -[[package]] -name = "traitobject" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04a79e25382e2e852e8da874249358d382ebaf259d0d34e75d8db16a7efabbc7" - [[package]] name = "try-lock" version = "0.2.5" @@ -6359,15 +6213,6 @@ dependencies = [ "toml", ] -[[package]] -name = "twoway" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" -dependencies = [ - "memchr", -] - [[package]] name = "twox-hash" version = "1.6.3" @@ -6378,27 +6223,12 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "typeable" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" - [[package]] name = "typeid" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" -[[package]] -name = "typemap" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" -dependencies = [ - "unsafe-any", -] - [[package]] name = "typenum" version = "1.17.0" @@ -6411,42 +6241,18 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" -[[package]] -name = "unicase" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" -dependencies = [ - "version_check 0.1.5", -] - [[package]] name = "unicase" version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" -[[package]] -name = "unicode-bidi" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" - [[package]] name = "unicode-ident" version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" -[[package]] -name = "unicode-normalization" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-width" version = "0.2.1" @@ -6465,15 +6271,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3" -[[package]] -name = "unsafe-any" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" -dependencies = [ - "traitobject", -] - [[package]] name = "unsafe-libyaml" version = "0.2.11" @@ -6486,17 +6283,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna 0.1.5", - "matches", - "percent-encoding 1.0.1", -] - [[package]] name = "url" version = "2.5.4" @@ -6504,8 +6290,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", - "idna 1.0.3", - "percent-encoding 2.3.1", + "idna", + "percent-encoding", ] [[package]] @@ -6608,6 +6394,15 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "wait-timeout" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc 0.2.177", +] + [[package]] name = "walkdir" version = "2.5.0" @@ -6627,12 +6422,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -6667,7 +6456,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", - "log 0.4.25", + "log", "proc-macro2", "quote", "syn 2.0.96", @@ -6769,6 +6558,12 @@ dependencies = [ "rustix 0.38.43", ] +[[package]] +name = "widestring" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" + [[package]] name = "winapi" version = "0.2.8" @@ -7254,6 +7049,16 @@ dependencies = [ "memchr", ] +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "winver" version = "1.0.0" @@ -7293,8 +7098,8 @@ dependencies = [ "bit_field", "bitflags 1.3.2", "csv", - "phf 0.9.0", - "phf_codegen 0.9.0", + "phf", + "phf_codegen", "raw-cpuid", "serde_json", ] diff --git a/Cargo.toml b/Cargo.toml index c671078e95b..133dc5f245b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,8 +5,9 @@ resolver = "2" [workspace.package] rust-version = "1.84.1" edition = "2021" -# Irrelevant version and license. These do NOT apply here, they just are here to make cargo build pass. -version = "0.0.1" +# Version must match libdatadog submodule version so that `version.workspace = true` crates +# resolve to a version compatible with their dependents' requirements. +version = "28.0.3" license = "Apache-2.0" [profile.dev] diff --git a/Makefile b/Makefile index a659308034d..2017f2d8c31 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ RUN_TESTS_CMD := DD_SERVICE= DD_ENV= REPORT_EXIT_STATUS=1 TEST_PHP_SRCDIR=$(PROJ C_FILES = $(shell find components components-rs ext src/dogstatsd zend_abstract_interface -name '*.c' -o -name '*.h' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' ) 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 }' ) -RUST_FILES = $(BUILD_DIR)/Cargo.toml $(BUILD_DIR)/Cargo.lock $(shell find components-rs -name '*.c' -o -name '*.rs' -o -name 'Cargo.toml' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' ) $(shell find libdatadog/{build-common,datadog-ffe,datadog-ipc,datadog-ipc-macros,datadog-live-debugger,datadog-live-debugger-ffi,datadog-remote-config,datadog-sidecar,datadog-sidecar-ffi,datadog-sidecar-macros,libdd-alloc,libdd-common,libdd-common-ffi,libdd-crashtracker,libdd-crashtracker-ffi,libdd-data-pipeline,libdd-ddsketch,libdd-dogstatsd-client,libdd-library-config,libdd-library-config-ffi,libdd-log,libdd-telemetry,libdd-telemetry-ffi,libdd-tinybytes,libdd-trace-*,spawn_worker,tools/{cc_utils,sidecar_mockgen},libdd-trace-*,Cargo.toml} \( -type l -o -type f \) \( -path "*/src*" -o -path "*/examples*" -o -path "*Cargo.toml" -o -path "*/build.rs" -o -path "*/tests/dataservice.rs" -o -path "*/tests/service_functional.rs" \) -not -path "*/datadog-ipc/build.rs" -not -path "*/datadog-sidecar-ffi/build.rs") +RUST_FILES = $(BUILD_DIR)/Cargo.toml $(BUILD_DIR)/Cargo.lock $(shell find components-rs -name '*.c' -o -name '*.rs' -o -name 'Cargo.toml' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' ) $(shell find libdatadog/{build-common,datadog-ffe,datadog-ipc,datadog-ipc-macros,datadog-live-debugger,datadog-live-debugger-ffi,datadog-remote-config,datadog-sidecar,datadog-sidecar-ffi,datadog-sidecar-macros,libdd-alloc,libdd-common,libdd-common-ffi,libdd-crashtracker,libdd-crashtracker-ffi,libdd-data-pipeline,libdd-ddsketch,libdd-dogstatsd-client,libdd-library-config,libdd-library-config-ffi,libdd-libunwind-sys,libdd-log,libdd-telemetry,libdd-telemetry-ffi,libdd-tinybytes,libdd-trace-*,spawn_worker,tools/{cc_utils,sidecar_mockgen},libdd-trace-*,Cargo.toml} \( -type l -o -type f \) \( -path "*/src*" -o -path "*/examples*" -o -path "*Cargo.toml" -o -path "*/build.rs" -o -path "*/tests/dataservice.rs" -o -path "*/tests/service_functional.rs" \) -not -path "*/datadog-ipc/build.rs" -not -path "*/datadog-sidecar-ffi/build.rs") ALL_OBJECT_FILES = $(C_FILES) $(RUST_FILES) $(BUILD_DIR)/Makefile TEST_OPCACHE_FILES = $(shell find tests/opcache -name '*.php*' -o -name '.gitkeep' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' ) TEST_STUB_FILES = $(shell find tests/ext -type d -name 'stubs' -exec find '{}' -type f \; | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' ) @@ -500,7 +500,7 @@ $(PACKAGES_BUILD_DIR)/datadog-setup.php: $(PACKAGES_BUILD_DIR) $(PACKAGES_BUILD_DIR) build_pecl_package: - echo $(subst $(BUILD_DIR)/,,$(C_FILES) $(RUST_FILES) $(TEST_FILES) $(TEST_STUB_FILES) $(M4_FILES) Cargo.lock) | tooling/bin/pecl-build + { echo $(subst $(BUILD_DIR)/,,$(C_FILES) $(RUST_FILES) $(TEST_FILES) $(TEST_STUB_FILES) $(M4_FILES) Cargo.lock); find libdatadog/libdd-libunwind-sys/libunwind -type f 2>/dev/null; } | tooling/bin/pecl-build dbgsym.tar.gz: $(PACKAGES_BUILD_DIR) $(if $(DDTRACE_MAKE_PACKAGES_ASAN), , tar -zcf $(PACKAGES_BUILD_DIR)/dd-library-php-$(VERSION)_windows_debugsymbols.tar.gz ./extensions_x86_64_debugsymbols --owner=0 --group=0) diff --git a/components-rs/common.h b/components-rs/common.h index e53c4ef311d..9e4e351b61a 100644 --- a/components-rs/common.h +++ b/components-rs/common.h @@ -1231,9 +1231,6 @@ typedef enum ddog_crasht_SignalNames { * variable to allow downgrading the collector. */ typedef enum ddog_crasht_StacktraceCollection { - /** - * Stacktrace collection occurs in the - */ DDOG_CRASHT_STACKTRACE_COLLECTION_DISABLED, DDOG_CRASHT_STACKTRACE_COLLECTION_WITHOUT_SYMBOLS, /** @@ -1388,6 +1385,14 @@ typedef struct ddog_crasht_Slice_CInt { uintptr_t len; } ddog_crasht_Slice_CInt; +/** + * Represents an object that should only be referred to by its handle. + * Do not access its member for any reason, only use the C API functions on this struct. + */ +typedef struct ddog_crasht_Handle_StackTrace { + struct ddog_crasht_StackTrace *inner; +} ddog_crasht_Handle_StackTrace; + /** * A generic result type for when an operation may fail, * or may return in case of success. @@ -1493,14 +1498,6 @@ typedef struct ddog_crasht_Span { ddog_CharSlice thread_name; } ddog_crasht_Span; -/** - * Represents an object that should only be referred to by its handle. - * Do not access its member for any reason, only use the C API functions on this struct. - */ -typedef struct ddog_crasht_Handle_StackTrace { - struct ddog_crasht_StackTrace *inner; -} ddog_crasht_Handle_StackTrace; - typedef struct ddog_crasht_ThreadData { bool crashed; ddog_CharSlice name; @@ -1875,6 +1872,13 @@ void ddog_endpoint_set_timeout(struct ddog_Endpoint *endpoint, uint64_t millis); void ddog_endpoint_set_test_token(struct ddog_Endpoint *endpoint, ddog_CharSlice token); +/** + * Set whether to use the system DNS resolver when building the reqwest client. + * If false, the default in-process resolver is used. + */ +void ddog_endpoint_set_use_system_resolver(struct ddog_Endpoint *endpoint, + bool use_system_resolver); + void ddog_endpoint_drop(struct ddog_Endpoint*); struct ddog_Option_U32 ddog_Option_U32_some(uint32_t v); diff --git a/components-rs/crashtracker.h b/components-rs/crashtracker.h index 69f1e565029..65ab3af974b 100644 --- a/components-rs/crashtracker.h +++ b/components-rs/crashtracker.h @@ -131,6 +131,45 @@ struct ddog_VoidResult ddog_crasht_init_without_receiver(struct ddog_crasht_Conf */ struct ddog_crasht_Slice_CInt ddog_crasht_default_signals(void); +/** + * Report an unhandled exception as a crash event. + * + * This function sends a crash report for an unhandled exception detected + * by the runtime. It is intended to be called when the process is in a + * terminal state due to an unhandled exception. + * + * # Parameters + * - `error_type`: Optional type/class of the exception (e.g. "NullPointerException"). Pass empty + * CharSlice for unknown. + * - `error_message`: Optional error message. Pass empty CharSlice for no message. + * - `runtime_stack`: Stack trace from the runtime. Consumed by this call. + * + * If the crash-tracker has not been initialized, this function is a no-op. + * + * # Side effects + * This function disables the signal-based crash handler before performing + * any work. This means that if the process receives a fatal signal (SIGSEGV) + * during or after this call, the crashtracker will not produce a + * second crash report. The previous signal handler (if any) will still be + * chained. + * + * # Failure mode + * If a fatal signal occurs while this function is in progress, the calling + * process is in an unrecoverable state; the crashtracker cannot report the + * secondary fault and the caller's own signal handler (if any) will execute + * in a potentially corrupted context. Callers should treat this function as a + * terminal operation and exit shortly after it returns. + * + * # Safety + * Crash-tracking functions are not reentrant. + * No other crash-handler functions should be called concurrently. + * The `runtime_stack` handle must be valid and will be consumed. + */ +DDOG_CHECK_RETURN +struct ddog_VoidResult ddog_crasht_report_unhandled_exception(ddog_CharSlice error_type, + ddog_CharSlice error_message, + struct ddog_crasht_Handle_StackTrace *runtime_stack); + /** * Removes all existing additional tags * Expected to be used after a fork, to reset the additional tags on the child @@ -661,7 +700,12 @@ struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_with_thread_name(struct ddog * The `builder` can be null, but if non-null it must point to a Builder made by this module, * which has not previously been dropped. * All arguments must be valid. - * This method requires that the builder has a UUID and metadata set + * This method requires that the builder has `metadata` and `kind` set + * Applications can add `message` or `sig_info` to the builder to provide additional context. + * If set, the data will be used to derive the crash ping message in the order of + * - an explicit message set with `with_message` + * - sig_info set with `with_sig_info` + * - kind set with `with_kind` */ DDOG_CHECK_RETURN struct ddog_VoidResult ddog_crasht_CrashInfoBuilder_upload_ping_to_endpoint(struct ddog_crasht_Handle_CrashInfoBuilder *builder, diff --git a/components-rs/library-config.h b/components-rs/library-config.h index 4bbc3d17f4a..c29b0cf3e55 100644 --- a/components-rs/library-config.h +++ b/components-rs/library-config.h @@ -91,6 +91,8 @@ void ddog_tracer_metadata_set(struct ddog_TracerMetadata *ptr, /** * Serializes the `TracerMetadata` into a platform-specific memory handle (e.g., memfd on Linux). + * This function also attempts to publish the tracer metadata as an OTel process context + * separately, but will ignore resulting errors. * * # Safety * - `ptr` must be a valid, non-null pointer to a `TracerMetadata`. diff --git a/components-rs/sidecar.h b/components-rs/sidecar.h index 2d694f91507..f3a586449f9 100644 --- a/components-rs/sidecar.h +++ b/components-rs/sidecar.h @@ -92,6 +92,16 @@ void ddog_sidecar_transport_drop(struct ddog_SidecarTransport*); */ ddog_MaybeError ddog_sidecar_connect(struct ddog_SidecarTransport **connection); +ddog_MaybeError ddog_sidecar_connect_master(int32_t pid); + +ddog_MaybeError ddog_sidecar_connect_worker(int32_t pid, struct ddog_SidecarTransport **connection); + +ddog_MaybeError ddog_sidecar_shutdown_master_listener(void); + +bool ddog_sidecar_is_master_listener_active(int32_t pid); + +ddog_MaybeError ddog_sidecar_clear_inherited_listener(void); + ddog_MaybeError ddog_sidecar_ping(struct ddog_SidecarTransport **transport); ddog_MaybeError ddog_sidecar_flush_traces(struct ddog_SidecarTransport **transport); diff --git a/ext/coms.c b/ext/coms.c index d79e7ea4088..1b0185aba40 100644 --- a/ext/coms.c +++ b/ext/coms.c @@ -1500,6 +1500,11 @@ bool ddtrace_coms_flush_shutdown_writer_synchronous(void) { bool ddtrace_coms_synchronous_flush(uint32_t timeout) { struct _writer_loop_data_t *writer = _dd_get_writer(); + + if (!writer->thread) { + return false; + } + uint32_t previous_writer_cycle = atomic_load(&writer->writer_cycle); uint32_t previous_processed_stacks_total = atomic_load(&writer->flush_processed_stacks_total); int64_t old_flush_interval = atomic_load(&writer->flush_interval); diff --git a/ext/configuration.c b/ext/configuration.c index 5e6e0bfca77..71fa4c0951a 100644 --- a/ext/configuration.c +++ b/ext/configuration.c @@ -96,6 +96,21 @@ static bool dd_parse_sampling_rules_format(zai_str value, zval *decoded_value, b return true; } +static bool dd_parse_sidecar_connection_mode(zai_str value, zval *decoded_value, bool persistent) { + UNUSED(persistent); + if (zai_str_eq_ci_cstr(value, "auto")) { + ZVAL_LONG(decoded_value, DD_TRACE_SIDECAR_CONNECTION_MODE_AUTO); + } else if (zai_str_eq_ci_cstr(value, "subprocess")) { + ZVAL_LONG(decoded_value, DD_TRACE_SIDECAR_CONNECTION_MODE_SUBPROCESS); + } else if (zai_str_eq_ci_cstr(value, "thread")) { + ZVAL_LONG(decoded_value, DD_TRACE_SIDECAR_CONNECTION_MODE_THREAD); + } else { + return false; + } + + return true; +} + static bool dd_parse_tags(zai_str value, zval *decoded_value, bool persistent) { ZVAL_ARR(decoded_value, pemalloc(sizeof(HashTable), persistent)); zend_hash_init(Z_ARR_P(decoded_value), 8, NULL, persistent ? ZVAL_INTERNAL_PTR_DTOR : ZVAL_PTR_DTOR, persistent); diff --git a/ext/configuration.h b/ext/configuration.h index 97b97875608..fde0b71e580 100644 --- a/ext/configuration.h +++ b/ext/configuration.h @@ -30,6 +30,12 @@ enum ddtrace_sampling_rules_format { DD_TRACE_SAMPLING_RULES_FORMAT_GLOB }; +enum ddtrace_sidecar_connection_mode { + DD_TRACE_SIDECAR_CONNECTION_MODE_AUTO = 0, // Default: try subprocess, fallback to thread + DD_TRACE_SIDECAR_CONNECTION_MODE_SUBPROCESS = 1, // Force subprocess only + DD_TRACE_SIDECAR_CONNECTION_MODE_THREAD = 2, // Force thread only +}; + /* From the curl docs on CONNECT_TIMEOUT_MS: * If libcurl is built to use the standard system name resolver, that * portion of the transfer will still use full-second resolution for @@ -225,6 +231,7 @@ enum ddtrace_sampling_rules_format { CONFIG(STRING, DD_TRACE_AGENT_TEST_SESSION_TOKEN, "", .ini_change = ddtrace_alter_test_session_token) \ CONFIG(BOOL, DD_TRACE_PROPAGATE_USER_ID_DEFAULT, "false") \ CONFIG(CUSTOM(INT), DD_DBM_PROPAGATION_MODE, "disabled", .parser = dd_parse_dbm_mode) \ + CONFIG(CUSTOM(INT), DD_TRACE_SIDECAR_CONNECTION_MODE, "auto", .parser = dd_parse_sidecar_connection_mode) \ CONFIG(SET, DD_TRACE_WORDPRESS_ADDITIONAL_ACTIONS, "") \ CONFIG(BOOL, DD_TRACE_WORDPRESS_CALLBACKS, "true") \ CONFIG(BOOL, DD_INTEGRATION_METRICS_ENABLED, "true", \ diff --git a/ext/ddtrace.c b/ext/ddtrace.c index e636e104684..525ccd275f7 100644 --- a/ext/ddtrace.c +++ b/ext/ddtrace.c @@ -454,10 +454,7 @@ static void dd_activate_once(void) { } // if we're to enable appsec, we need to enable sidecar - bool enable_sidecar = ddtrace_sidecar_maybe_enable_appsec(&appsec_activation, &appsec_config); - if (!enable_sidecar) { - enable_sidecar = get_global_DD_INSTRUMENTATION_TELEMETRY_ENABLED() || get_global_DD_TRACE_SIDECAR_TRACE_SENDER(); - } + bool enable_sidecar = ddtrace_sidecar_should_enable(&appsec_activation, &appsec_config); if (enable_sidecar) #endif @@ -1530,6 +1527,7 @@ static PHP_MINIT_FUNCTION(ddtrace) { #endif ddshared_minit(); ddtrace_autoload_minit(); + ddtrace_sidecar_minit(); dd_register_span_data_ce(); dd_register_fatal_error_ce(); @@ -2661,6 +2659,8 @@ void dd_internal_handle_fork(void) { ddtrace_coms_clean_background_sender_after_fork(); } #endif + + ddtrace_sidecar_handle_fork(); if (DDTRACE_G(agent_config_reader)) { ddog_agent_remote_config_reader_drop(DDTRACE_G(agent_config_reader)); DDTRACE_G(agent_config_reader) = NULL; @@ -2675,7 +2675,6 @@ void dd_internal_handle_fork(void) { } ddtrace_seed_prng(); ddtrace_generate_runtime_id(); - ddtrace_reset_sidecar(); if (!get_DD_TRACE_FORKED_PROCESS()) { ddtrace_disable_tracing_in_current_request(); } diff --git a/ext/sidecar.c b/ext/sidecar.c index 73b653fd7cb..011d23bb075 100644 --- a/ext/sidecar.c +++ b/ext/sidecar.c @@ -1,3 +1,5 @@ +#include +#include
#include "ddtrace.h" #include "auto_flush.h" #include "compat_string.h" @@ -27,6 +29,10 @@ ddog_Endpoint *dogstatsd_endpoint; // always set when ddtrace_endpoint is set struct ddog_InstanceId *ddtrace_sidecar_instance_id; static uint8_t dd_sidecar_formatted_session_id[36]; +// Connection mode tracking +dd_sidecar_active_mode_t ddtrace_sidecar_active_mode = DD_SIDECAR_CONNECTION_NONE; +int32_t ddtrace_sidecar_master_pid = 0; + static inline void dd_set_endpoint_test_token(ddog_Endpoint *endpoint) { if (zai_config_is_initialized()) { if (ZSTR_LEN(get_DD_TRACE_AGENT_TEST_SESSION_TOKEN())) { @@ -133,6 +139,10 @@ void ddtrace_sidecar_update_process_tags(void) { ddog_sidecar_session_set_process_tags(&ddtrace_sidecar, session_id, dd_zend_string_to_CharSlice(process_tags)); } +static ddog_SidecarTransport *dd_sidecar_connection_factory_ex(bool is_fork); +static ddog_SidecarTransport *dd_sidecar_connection_factory_thread(void); +static void ddtrace_sidecar_setup_thread_mode(bool appsec_activation, bool appsec_config); + static void dd_sidecar_on_reconnect(ddog_SidecarTransport *transport) { if (!ddtrace_endpoint || !dogstatsd_endpoint) { return; @@ -188,8 +198,7 @@ static void dd_sidecar_on_reconnect(ddog_SidecarTransport *transport) { } -static ddog_SidecarTransport *dd_sidecar_connection_factory_ex(bool is_fork) { - // Should not happen, unless the agent url is malformed +static ddog_SidecarTransport *dd_sidecar_connect(bool as_worker, bool is_fork) { if (!ddtrace_endpoint) { return NULL; } @@ -198,19 +207,56 @@ static ddog_SidecarTransport *dd_sidecar_connection_factory_ex(bool is_fork) { dd_set_endpoint_test_token(dogstatsd_endpoint); #ifdef _WIN32 - DDOG_PHP_FUNCTION = (const uint8_t *)zend_hash_func; -#endif - + char logpath[MAX_PATH]; + if (!as_worker) { + DDOG_PHP_FUNCTION = (const uint8_t *)zend_hash_func; + } +#else char logpath[MAXPATHLEN]; +#endif int error_fd = atomic_load(&ddtrace_error_log_fd); if (error_fd == -1 || ddtrace_get_fd_path(error_fd, logpath) < 0) { *logpath = 0; } ddog_SidecarTransport *sidecar_transport; - if (!ddtrace_ffi_try("Failed connecting to the sidecar", ddog_sidecar_connect_php(&sidecar_transport, logpath, dd_zend_string_to_CharSlice(get_global_DD_TRACE_LOG_LEVEL()), get_global_DD_INSTRUMENTATION_TELEMETRY_ENABLED(), dd_sidecar_on_reconnect, ddtrace_endpoint))) { - dd_free_endpoints(); - return NULL; + if (as_worker) { + if (!ddtrace_ffi_try("Failed connecting to sidecar as worker", + ddog_sidecar_connect_worker((int32_t)ddtrace_sidecar_master_pid, &sidecar_transport))) { +#ifdef _WIN32 + int32_t current_pid = (int32_t)GetCurrentProcessId(); +#else + int32_t current_pid = (int32_t)getpid(); +#endif + // If we're an orphaned child, promote this process to master so traces can still be submitted. + if (current_pid != ddtrace_sidecar_master_pid) { + LOG(INFO, "Parent's sidecar listener gone (child PID=%d, master=%d), promoting to master", + current_pid, ddtrace_sidecar_master_pid); + ddtrace_sidecar_master_pid = current_pid; + if (!ddtrace_ffi_try("Failed starting sidecar master listener as orphaned child", + ddog_sidecar_connect_master((int32_t)ddtrace_sidecar_master_pid)) || + !ddtrace_ffi_try("Failed connecting to new sidecar master as orphaned child", + ddog_sidecar_connect_worker((int32_t)ddtrace_sidecar_master_pid, &sidecar_transport))) { + dd_free_endpoints(); + return NULL; + } + } else { + LOG(ERROR, "Failed connecting to own sidecar master listener (PID=%d)", current_pid); + dd_free_endpoints(); + return NULL; + } + } + ddtrace_sidecar_active_mode = DD_SIDECAR_CONNECTION_THREAD; + } else { + if (!ddtrace_ffi_try("Failed connecting to sidecar (subprocess mode)", + ddog_sidecar_connect_php(&sidecar_transport, logpath, + dd_zend_string_to_CharSlice(get_global_DD_TRACE_LOG_LEVEL()), + get_global_DD_INSTRUMENTATION_TELEMETRY_ENABLED(), + dd_sidecar_on_reconnect, + ddtrace_endpoint))) { + return NULL; + } + ddtrace_sidecar_active_mode = DD_SIDECAR_CONNECTION_SUBPROCESS; } dd_sidecar_post_connect(&sidecar_transport, is_fork, logpath); @@ -218,8 +264,113 @@ static ddog_SidecarTransport *dd_sidecar_connection_factory_ex(bool is_fork) { return sidecar_transport; } -ddog_SidecarTransport *dd_sidecar_connection_factory(void) { - return dd_sidecar_connection_factory_ex(false); +static void ddtrace_sidecar_setup_thread_mode(bool appsec_activation, bool appsec_config) { +#ifndef _WIN32 + int32_t current_pid = (int32_t)getpid(); +#else + int32_t current_pid = (int32_t)GetCurrentProcessId(); +#endif + bool is_child_process = (ddtrace_sidecar_master_pid != 0 && current_pid != ddtrace_sidecar_master_pid); + + bool listener_available = ddog_sidecar_is_master_listener_active(ddtrace_sidecar_master_pid); + + if (is_child_process || listener_available) { + ddtrace_sidecar = dd_sidecar_connect(true, false); + if (ddtrace_sidecar) { + if (is_child_process) { + LOG(INFO, "Worker connected to sidecar master listener (worker PID=%d, master PID=%d)", + (int32_t)current_pid, ddtrace_sidecar_master_pid); + } + return; + } + + if (!is_child_process) { + // listener_available was true but connect failed (e.g. race: socket not yet bound) + LOG(WARN, "Failed to connect to own master listener (PID=%d)", (int32_t)current_pid); + return; + } + + // Worker processes must not start their own listener thread - the master listener + // must be started in MINIT (in the master process) so it survives forking. + // If we can't connect, run without the sidecar rather than starting a per-worker thread. + LOG(WARN, "Cannot connect to master sidecar listener from worker (child PID=%d, master PID=%d)", + (int32_t)current_pid, ddtrace_sidecar_master_pid); + return; + } + + if (!ddtrace_ffi_try("Failed starting sidecar master listener", ddog_sidecar_connect_master((int32_t)ddtrace_sidecar_master_pid))) { + LOG(WARN, "Failed to start sidecar master listener"); + if (ddtrace_endpoint) { + dd_free_endpoints(); + } + return; + } + + LOG(INFO, "Started sidecar master listener thread (PID=%d)", ddtrace_sidecar_master_pid); + + ddtrace_sidecar = dd_sidecar_connect(true, false); + if (!ddtrace_sidecar) { + LOG(WARN, "Failed to connect master process to sidecar"); + return; + } + + if (get_global_DD_INSTRUMENTATION_TELEMETRY_ENABLED()) { + ddtrace_telemetry_first_init(); + } +} + +ddog_SidecarTransport *ddtrace_sidecar_connect(bool is_fork) { + if (ddtrace_sidecar_active_mode == DD_SIDECAR_CONNECTION_SUBPROCESS) { + return dd_sidecar_connect(false, is_fork); + } else if (ddtrace_sidecar_active_mode == DD_SIDECAR_CONNECTION_THREAD) { + return dd_sidecar_connect(true, is_fork); + } + + zend_long mode = get_global_DD_TRACE_SIDECAR_CONNECTION_MODE(); + ddog_SidecarTransport *transport = NULL; + + switch (mode) { + case DD_TRACE_SIDECAR_CONNECTION_MODE_SUBPROCESS: + // Force subprocess only + transport = dd_sidecar_connect(false, is_fork); + if (!transport) { + LOG(ERROR, "Subprocess connection failed (mode=subprocess, no fallback)"); + } + break; + + case DD_TRACE_SIDECAR_CONNECTION_MODE_THREAD: + // Force thread only + transport = dd_sidecar_connect(true, is_fork); + if (!transport) { + LOG(ERROR, "Thread connection failed (mode=thread, no fallback)"); + } + break; + + case DD_TRACE_SIDECAR_CONNECTION_MODE_AUTO: + default: + // Try subprocess first, fallback to thread if needed + transport = dd_sidecar_connect(false, is_fork); + + if (!transport) { + if (ddtrace_endpoint) { + LOG(WARN, "Subprocess connection failed, falling back to thread mode"); + transport = dd_sidecar_connect(true, is_fork); + + if (transport) { + LOG(INFO, "Connected to sidecar via thread (fallback)"); + } else { + LOG(ERROR, "Both subprocess and thread connections failed, sidecar unavailable"); + } + } + } + break; + } + + return transport; +} + +static ddog_SidecarTransport *ddtrace_sidecar_connect_callback(void) { + return ddtrace_sidecar_connect(false); } bool ddtrace_sidecar_maybe_enable_appsec(bool *appsec_activation, bool *appsec_config) { @@ -246,27 +397,123 @@ bool ddtrace_sidecar_maybe_enable_appsec(bool *appsec_activation, bool *appsec_c #endif } +bool ddtrace_sidecar_should_enable(bool *appsec_activation, bool *appsec_config) { + bool enable_sidecar = ddtrace_sidecar_maybe_enable_appsec(appsec_activation, appsec_config); + if (!enable_sidecar) { + enable_sidecar = get_global_DD_INSTRUMENTATION_TELEMETRY_ENABLED() || + get_global_DD_TRACE_SIDECAR_TRACE_SENDER(); + } + return enable_sidecar; +} + void ddtrace_sidecar_setup(bool appsec_activation, bool appsec_config) { ddtrace_set_non_resettable_sidecar_globals(); ddtrace_set_resettable_sidecar_globals(); ddog_init_remote_config(get_global_DD_INSTRUMENTATION_TELEMETRY_ENABLED(), appsec_activation, appsec_config); - ddtrace_sidecar = dd_sidecar_connection_factory(); - if (!ddtrace_sidecar) { // Something went wrong + zend_long mode = get_global_DD_TRACE_SIDECAR_CONNECTION_MODE(); + + if (mode == DD_TRACE_SIDECAR_CONNECTION_MODE_THREAD) { + ddtrace_sidecar_setup_thread_mode(appsec_activation, appsec_config); + return; + } + + ddtrace_sidecar = dd_sidecar_connect(false, false); + + if (!ddtrace_sidecar) { + if (mode == DD_TRACE_SIDECAR_CONNECTION_MODE_AUTO && ddtrace_endpoint) { + LOG(WARN, "Subprocess connection failed, falling back to thread mode"); + ddtrace_sidecar_setup_thread_mode(appsec_activation, appsec_config); + return; + } + if (ddtrace_endpoint) { dd_free_endpoints(); } + } else if (get_global_DD_INSTRUMENTATION_TELEMETRY_ENABLED()) { + ddtrace_telemetry_first_init(); } +} - if (get_global_DD_INSTRUMENTATION_TELEMETRY_ENABLED()) { - ddtrace_telemetry_first_init(); +void ddtrace_sidecar_minit(void) { +#ifdef _WIN32 + ddtrace_sidecar_master_pid = (int32_t)GetCurrentProcessId(); +#else + ddtrace_sidecar_master_pid = (int32_t)getpid(); +#endif + + zend_long mode = get_global_DD_TRACE_SIDECAR_CONNECTION_MODE(); + + if (mode == DD_TRACE_SIDECAR_CONNECTION_MODE_THREAD) { + ddtrace_ffi_try("Starting sidecar master listener in MINIT", + ddog_sidecar_connect_master(ddtrace_sidecar_master_pid)); } } +void ddtrace_sidecar_handle_fork(void) { +#ifndef _WIN32 + bool appsec_activation = false; + bool appsec_config = false; + bool enable_sidecar = ddtrace_sidecar_should_enable(&appsec_activation, &appsec_config); + + if (!enable_sidecar) { + return; + } + + ddtrace_force_new_instance_id(); + + if (ddtrace_sidecar) { + ddog_sidecar_transport_drop(ddtrace_sidecar); + ddtrace_sidecar = NULL; + } + + if (ddtrace_sidecar_active_mode == DD_SIDECAR_CONNECTION_THREAD) { + ddtrace_ffi_try("Failed clearing inherited listener state", + ddog_sidecar_clear_inherited_listener()); + + // Try to connect as a worker to parent's listener + ddtrace_sidecar = dd_sidecar_connect(true, true); + if (ddtrace_sidecar) { + LOG(INFO, "Child process reconnected to parent's sidecar listener after fork (child PID=%d, parent=%d)", + (int32_t)getpid(), ddtrace_sidecar_master_pid); + return; + } + + // Parent's listener not available, fall back to starting a new master in this process + LOG(INFO, "Parent's sidecar listener not available after fork (child PID=%d, parent=%d), starting new master", + (int32_t)getpid(), ddtrace_sidecar_master_pid); + + ddtrace_sidecar_master_pid = (int32_t)getpid(); + if (!ddtrace_ffi_try("Failed starting sidecar master listener in child process", + ddog_sidecar_connect_master((int32_t)ddtrace_sidecar_master_pid))) { + if (ddtrace_endpoint) { + dd_free_endpoints(); + } + return; + } + + ddtrace_sidecar = dd_sidecar_connect(true, false); + if (!ddtrace_sidecar) { + LOG(WARN, "Failed to connect to new sidecar master in child process (PID=%d)", + (int32_t)getpid()); + } + } else if (ddtrace_sidecar_active_mode == DD_SIDECAR_CONNECTION_SUBPROCESS) { + ddtrace_sidecar = ddtrace_sidecar_connect(true); + if (!ddtrace_sidecar) { + if (ddtrace_endpoint) { + dd_free_endpoints(); + } + } else { + ddtrace_sidecar_submit_root_span_data(); + } + } +#endif +} + void ddtrace_sidecar_ensure_active(void) { if (ddtrace_sidecar) { - ddtrace_sidecar_reconnect(&ddtrace_sidecar, dd_sidecar_connection_factory); + ddtrace_sidecar_reconnect(&ddtrace_sidecar, ddtrace_sidecar_connect_callback); } } @@ -291,8 +538,31 @@ void ddtrace_sidecar_finalize(bool clear_id) { } void ddtrace_sidecar_shutdown(void) { + // Shutdown master listener if this is the master process and thread mode is active +#ifdef _WIN32 + int32_t current_pid = (int32_t)GetCurrentProcessId(); +#else + int32_t current_pid = (int32_t)getpid(); +#endif + if (ddtrace_sidecar_active_mode == DD_SIDECAR_CONNECTION_THREAD && + ddtrace_sidecar_master_pid != 0 && + current_pid == ddtrace_sidecar_master_pid) { + + // Close worker connection first to avoid deadlock + if (ddtrace_sidecar) { + ddog_sidecar_transport_drop(ddtrace_sidecar); + ddtrace_sidecar = NULL; + } + + // Then shutdown listener thread + ddtrace_ffi_try("Failed shutting down master listener", + ddog_sidecar_shutdown_master_listener()); + } + + // Standard cleanup if (ddtrace_sidecar_instance_id) { ddog_sidecar_instanceId_drop(ddtrace_sidecar_instance_id); + ddtrace_sidecar_instance_id = NULL; } if (ddtrace_endpoint) { @@ -301,7 +571,11 @@ void ddtrace_sidecar_shutdown(void) { if (ddtrace_sidecar) { ddog_sidecar_transport_drop(ddtrace_sidecar); + ddtrace_sidecar = NULL; } + + // Reset mode + ddtrace_sidecar_active_mode = DD_SIDECAR_CONNECTION_NONE; } void ddtrace_force_new_instance_id(void) { @@ -311,22 +585,6 @@ void ddtrace_force_new_instance_id(void) { } } -void ddtrace_reset_sidecar(void) { - ddtrace_force_new_instance_id(); - - if (ddtrace_sidecar) { - ddog_sidecar_transport_drop(ddtrace_sidecar); - ddtrace_sidecar = dd_sidecar_connection_factory_ex(true); - if (!ddtrace_sidecar) { // Something went wrong - if (ddtrace_endpoint) { - dd_free_endpoints(); - } - } else { - ddtrace_sidecar_submit_root_span_data(); - } - } -} - ddog_Endpoint *ddtrace_sidecar_agent_endpoint(void) { ddog_Endpoint *agent_endpoint; diff --git a/ext/sidecar.h b/ext/sidecar.h index 5fa16bd2793..b18bea433e2 100644 --- a/ext/sidecar.h +++ b/ext/sidecar.h @@ -7,9 +7,18 @@ #include "ddtrace.h" #include "zend_string.h" +// Connection mode tracking +typedef enum { + DD_SIDECAR_CONNECTION_NONE = 0, + DD_SIDECAR_CONNECTION_SUBPROCESS = 1, + DD_SIDECAR_CONNECTION_THREAD = 2 +} dd_sidecar_active_mode_t; + extern ddog_SidecarTransport *ddtrace_sidecar; extern ddog_Endpoint *ddtrace_endpoint; extern struct ddog_InstanceId *ddtrace_sidecar_instance_id; +extern dd_sidecar_active_mode_t ddtrace_sidecar_active_mode; +extern int32_t ddtrace_sidecar_master_pid; DDTRACE_PUBLIC const uint8_t *ddtrace_get_formatted_session_id(void); struct telemetry_rc_info { @@ -20,13 +29,19 @@ struct telemetry_rc_info { }; DDTRACE_PUBLIC struct telemetry_rc_info ddtrace_get_telemetry_rc_info(void); +// Connection functions +ddog_SidecarTransport *ddtrace_sidecar_connect(bool is_fork); + +// Lifecycle functions +void ddtrace_sidecar_minit(void); void ddtrace_sidecar_setup(bool appsec_activation, bool appsec_config); +void ddtrace_sidecar_handle_fork(void); bool ddtrace_sidecar_maybe_enable_appsec(bool *appsec_activation, bool *appsec_config); +bool ddtrace_sidecar_should_enable(bool *appsec_activation, bool *appsec_config); void ddtrace_sidecar_ensure_active(void); void ddtrace_sidecar_update_process_tags(void); void ddtrace_sidecar_finalize(bool clear_id); void ddtrace_sidecar_shutdown(void); -void ddtrace_reset_sidecar(void); void ddtrace_force_new_instance_id(void); void ddtrace_sidecar_submit_root_span_data(void); void ddtrace_sidecar_push_tag(ddog_Vec_Tag *vec, ddog_CharSlice key, ddog_CharSlice value); diff --git a/libdatadog b/libdatadog index a0cef26b024..e93220ad0df 160000 --- a/libdatadog +++ b/libdatadog @@ -1 +1 @@ -Subproject commit a0cef26b0240f19dd994d471d5679e8c426adfc8 +Subproject commit e93220ad0df4e2e87d308c92a1feb0be6f05b4f3 diff --git a/metadata/supported-configurations.json b/metadata/supported-configurations.json index 001ce65306d..fb2578207e7 100644 --- a/metadata/supported-configurations.json +++ b/metadata/supported-configurations.json @@ -2167,6 +2167,13 @@ "default": "5000" } ], + "DD_TRACE_SIDECAR_CONNECTION_MODE": [ + { + "implementation": "A", + "type": "string", + "default": "auto" + } + ], "DD_TRACE_SIDECAR_TRACE_SENDER": [ { "implementation": "A", diff --git a/profiling/Cargo.toml b/profiling/Cargo.toml index e41cb405526..e0c5788d413 100644 --- a/profiling/Cargo.toml +++ b/profiling/Cargo.toml @@ -23,10 +23,10 @@ cpu-time = { version = "1.0" } chrono = { version = "0.4" } crossbeam-channel = { version = "0.5", default-features = false, features = ["std"] } http = { version = "1.4" } -libdd-alloc = { git = "https://github.com/DataDog/libdatadog", tag = "v27.0.0" } -libdd-profiling = { git = "https://github.com/DataDog/libdatadog", tag = "v27.0.0" } -libdd-common = { git = "https://github.com/DataDog/libdatadog", tag = "v27.0.0" } -libdd-library-config-ffi = { path = "../libdatadog/libdd-library-config-ffi" } +libdd-alloc = { git = "https://github.com/DataDog/libdatadog", tag = "v28.0.3" } +libdd-profiling = { git = "https://github.com/DataDog/libdatadog", tag = "v28.0.3" } +libdd-common = { git = "https://github.com/DataDog/libdatadog", tag = "v28.0.3" } +libdd-library-config-ffi = { git = "https://github.com/DataDog/libdatadog", tag = "v28.0.3" } env_logger = { version = "0.11", default-features = false } lazy_static = { version = "1.4" } libc = "0.2" diff --git a/tests/Common/WebFrameworkTestCase.php b/tests/Common/WebFrameworkTestCase.php index 022e6330d06..2cc64a5e307 100644 --- a/tests/Common/WebFrameworkTestCase.php +++ b/tests/Common/WebFrameworkTestCase.php @@ -180,10 +180,19 @@ protected static function setUpWebServer(array $additionalEnvs = [], array $addi } self::$appServer->setFrankenphp(); } + static::configureWebServer(self::$appServer); self::$appServer->start(); } } + /** + * Hook called after the WebServer is configured but before it is started. + * Override in subclasses to apply additional configuration (e.g. FPM user). + */ + protected static function configureWebServer(WebServer $server) + { + } + /** * Tear down the web server. */ diff --git a/tests/Integrations/Custom/Autoloaded/SidecarThreadModeRootTest.php b/tests/Integrations/Custom/Autoloaded/SidecarThreadModeRootTest.php new file mode 100644 index 00000000000..a474f177dc2 --- /dev/null +++ b/tests/Integrations/Custom/Autoloaded/SidecarThreadModeRootTest.php @@ -0,0 +1,164 @@ + 'sidecar-thread-mode-root-test', + 'DD_TRACE_SIDECAR_CONNECTION_MODE' => 'thread', + ]); + } + + /** @var bool */ + private static $useSudo = false; + + public static function ddSetUpBeforeClass() + { + if (\getenv('DD_TRACE_TEST_SAPI') !== 'fpm-fcgi') { + self::markTestSkipped('This test only runs under fpm-fcgi SAPI'); + } + + $isRoot = \function_exists('posix_geteuid') && \posix_geteuid() === 0; + $hasSudo = !$isRoot && \shell_exec('sudo -n true 2>/dev/null; echo $?') === "0\n"; + + if (!$isRoot && !$hasSudo) { + self::markTestSkipped('This test requires root or passwordless sudo to start php-fpm as root'); + } + + self::$useSudo = !$isRoot; + + self::$workerUser = self::findUnprivilegedUser(); + if (self::$workerUser === null) { + self::markTestSkipped('No unprivileged user found on this system (tried www-data, daemon, nobody)'); + } + + parent::ddSetUpBeforeClass(); + } + + protected static function configureWebServer(WebServer $server) + { + // Tell FPM to switch worker processes to the unprivileged user after forking. + $server->setPhpFpmUser(self::$workerUser); + $server->setPhpFpmMaxChildren(3); + if (self::$useSudo) { + $server->setPhpFpmSudo(true); + } + // Pass connection mode as a command-line INI flag to the FPM master process + $server->setPhpFpmMasterIni(['datadog.trace.sidecar_connection_mode' => 'thread']); + } + + /** + * Verifies that a single request succeeds when the FPM master runs as root + * and workers run as an unprivileged user. + */ + public function testTracesAreSubmittedWithRootMasterAndUnprivilegedWorker() + { + $traces = $this->tracesFromWebRequest(function () { + $this->call(GetSpec::create('Root+worker thread mode', '/simple')); + }); + + $this->assertNotEmpty($traces, 'No traces received — worker likely failed to access SHM after fchown()'); + $this->assertSame('web.request', $traces[0][0]['name']); + $this->assertSame('sidecar-thread-mode-root-test', $traces[0][0]['service']); + } + + /** + * Verifies that in thread mode, only the FPM master owns the sidecar listener + * thread — workers connect to it rather than each spawning their own thread. + * + * After all workers have served a + * request the master process must have > 1 thread (main + sidecar listener) while + * every worker must have exactly 1 thread. + */ + public function testMultipleWorkersShareSingleMasterListenerThread() + { + $traces = $this->tracesFromWebRequest(function () { + for ($i = 0; $i < 3; $i++) { + $this->call(GetSpec::create("Worker request $i", '/simple')); + } + }, null, $this->untilNumberOfTraces(3)); + + $this->assertGreaterThanOrEqual(3, \count($traces), 'Expected at least 3 traces from multiple worker requests'); + + // Identify master vs worker processes. + $allPids = array_values(array_filter(array_map('intval', explode("\n", trim(\shell_exec('pgrep php-fpm') ?: ''))))); + $this->assertNotEmpty($allPids, 'No php-fpm processes found'); + + $masterPid = null; + $workerPids = []; + foreach ($allPids as $pid) { + $ppid = (int) trim(\shell_exec("ps -o ppid= -p $pid 2>/dev/null") ?: '0'); + if (\in_array($ppid, $allPids, true)) { + $workerPids[] = $pid; + } else { + $masterPid = $pid; + } + } + + $this->assertNotNull($masterPid, 'Could not identify php-fpm master process'); + $this->assertCount(3, $workerPids, 'Expected exactly 3 worker processes (pm=static, max_children=3)'); + + // Master must have >1 thread: its main thread + the sidecar listener thread. + $masterThreads = $this->readProcThreadCount($masterPid); + $this->assertGreaterThan( + 1, + $masterThreads, + "Master (PID $masterPid) should have >1 thread (main + sidecar listener)" + ); + + // Workers may have a Rust async-I/O thread for the client connection, but they + // must NOT have the sidecar listener thread — that lives only in the master. + // Therefore master must have strictly more threads than every worker. + foreach ($workerPids as $workerPid) { + $workerThreads = $this->readProcThreadCount($workerPid); + $this->assertGreaterThan( + $workerThreads, + $masterThreads, + "Master (PID $masterPid, threads=$masterThreads) should have more threads than " . + "worker (PID $workerPid, threads=$workerThreads) — master owns the sidecar listener thread" + ); + } + } + + private function readProcThreadCount($pid) + { + $status = @\file_get_contents("/proc/$pid/status"); + if ($status === false) { + return 0; + } + \preg_match('/^Threads:\s+(\d+)/m', $status, $m); + return isset($m[1]) ? (int) $m[1] : 0; + } + + /** + * Returns the first unprivileged user found on the system, or null if none. + */ + private static function findUnprivilegedUser() + { + foreach (['www-data', 'daemon', 'nobody'] as $candidate) { + if (\posix_getpwnam($candidate) !== false) { + return $candidate; + } + } + return null; + } +} diff --git a/tests/Integrations/Custom/Autoloaded/SidecarThreadModeTest.php b/tests/Integrations/Custom/Autoloaded/SidecarThreadModeTest.php new file mode 100644 index 00000000000..942032fe1be --- /dev/null +++ b/tests/Integrations/Custom/Autoloaded/SidecarThreadModeTest.php @@ -0,0 +1,76 @@ + 'sidecar-thread-mode-test', + 'DD_TRACE_SIDECAR_CONNECTION_MODE' => 'thread', + 'DD_TRACE_DEBUG' => '0', + ]); + } + + public function testThreadModeTracesAreSubmitted() + { + if (\getenv('DD_TRACE_TEST_SAPI') !== 'fpm-fcgi') { + $this->markTestSkipped('This test requires DD_TRACE_TEST_SAPI=fpm-fcgi'); + } + + // This test validates that when thread mode is explicitly configured, + // traces are successfully submitted through the thread-based sidecar + $traces = $this->tracesFromWebRequest(function () { + $spec = GetSpec::create('Thread mode trace', '/simple?key=value'); + $this->call($spec); + }); + + // Verify traces were submitted + $this->assertNotEmpty($traces, 'Expected traces to be submitted through thread-based sidecar'); + $this->assertCount(1, $traces[0], 'Expected one span in the trace'); + + $span = $traces[0][0]; + $this->assertSame('web.request', $span['name']); + $this->assertSame('sidecar-thread-mode-test', $span['service']); + } + + public function testThreadModeMultipleRequests() + { + if (\getenv('DD_TRACE_TEST_SAPI') !== 'fpm-fcgi') { + $this->markTestSkipped('This test requires DD_TRACE_TEST_SAPI=fpm-fcgi'); + } + + // This test validates that multiple PHP-FPM workers can successfully + // connect to the same master listener thread and submit traces + $traces = $this->tracesFromWebRequest(function () { + for ($i = 0; $i < 3; $i++) { + $spec = GetSpec::create("Request $i", "/simple?request=$i"); + $this->call($spec); + } + }, null, $this->untilNumberOfTraces(3)); + + // Verify all traces were submitted + $this->assertGreaterThanOrEqual(3, count($traces), 'Expected at least 3 traces from multiple requests'); + + foreach ($traces as $trace) { + $this->assertNotEmpty($trace); + $this->assertSame('web.request', $trace[0]['name']); + } + } +} diff --git a/tests/Sapi/PhpFpm/PhpFpm.php b/tests/Sapi/PhpFpm/PhpFpm.php index 239e465af8b..6ee550caaa0 100644 --- a/tests/Sapi/PhpFpm/PhpFpm.php +++ b/tests/Sapi/PhpFpm/PhpFpm.php @@ -44,28 +44,58 @@ final class PhpFpm implements Sapi */ private $port; + /** + * @var int + */ + private $maxChildren; + + /** + * @var bool + */ + private $runAsSudo; + + /** + * @var array + */ + private $masterInis; + /** * @param string $rootPath * @param string $host * @param int $port * @param array $envs * @param array $inis + * @param int $maxChildren + * @param string|null $fpmUser + * @param string|null $fpmGroup + * @param bool $runAsSudo + * @param array $masterInis */ - public function __construct($rootPath, $host, $port, array $envs = [], array $inis = []) + public function __construct($rootPath, $host, $port, array $envs = [], array $inis = [], $maxChildren = 1, $fpmUser = null, $fpmGroup = null, $runAsSudo = false, array $masterInis = []) { $this->envs = $envs; $this->inis = $inis; $this->host = $host; $this->port = $port; + $this->maxChildren = $maxChildren; + $this->runAsSudo = $runAsSudo; + $this->masterInis = $masterInis; $logPath = $rootPath . '/' . self::ERROR_LOG; + $userGroup = ''; + if ($fpmUser !== null) { + $userGroup = "user = $fpmUser\ngroup = " . ($fpmGroup !== null ? $fpmGroup : $fpmUser); + } + $replacements = [ '{{fcgi_host}}' => $host, '{{fcgi_port}}' => $port, + '{{max_children}}' => $maxChildren, '{{envs}}' => $this->envsForConfFile(), '{{inis}}' => $this->inisForConfFile(), '{{error_log}}' => $logPath, + '{{user_group}}' => $userGroup, ]; $configContent = str_replace( array_keys($replacements), @@ -88,8 +118,15 @@ public function __construct($rootPath, $host, $port, array $envs = [], array $in public function start() { + $iniFlags = ''; + foreach ($this->masterInis as $name => $value) { + $iniFlags .= sprintf(' -d %s=%s', $name, escapeshellarg((string)$value)); + } + $cmd = sprintf( - 'php-fpm -p %s --fpm-config %s -F', + '%sphp-fpm%s -p %s --fpm-config %s -F', + $this->runAsSudo ? 'sudo ' : '', + $iniFlags, __DIR__, $this->configFile ); diff --git a/tests/Sapi/PhpFpm/www.conf b/tests/Sapi/PhpFpm/www.conf index 6dd5da6df13..eda0cd2ebc6 100644 --- a/tests/Sapi/PhpFpm/www.conf +++ b/tests/Sapi/PhpFpm/www.conf @@ -3,9 +3,9 @@ error_log = {{error_log}} [www] listen = {{fcgi_host}}:{{fcgi_port}} - +{{user_group}} pm = static -pm.max_children = 1 +pm.max_children = {{max_children}} pm.status_path = /status catch_workers_output = yes diff --git a/tests/WebServer.php b/tests/WebServer.php index ce7d27c1dbf..12684a3c10c 100644 --- a/tests/WebServer.php +++ b/tests/WebServer.php @@ -80,6 +80,12 @@ final class WebServer private $isOctane = false; private $isFrankenphp = false; private $isSwoole = false; + private $phpFpmMaxChildren = 1; + private $phpFpmUser = null; + private $phpFpmGroup = null; + private $phpFpmSudo = false; + private $phpFpmMasterInis = []; + private $forceSapi = null; private $defaultInis = [ 'log_errors' => 'on', @@ -132,6 +138,32 @@ public function setFrankenphp() $this->isFrankenphp = true; } + public function setPhpFpmMaxChildren($maxChildren) + { + $this->phpFpmMaxChildren = $maxChildren; + } + + public function setPhpFpmUser($user, $group = null) + { + $this->phpFpmUser = $user; + $this->phpFpmGroup = $group; + } + + public function setPhpFpmSudo($sudo = true) + { + $this->phpFpmSudo = $sudo; + } + + public function setPhpFpmMasterIni(array $inis) + { + $this->phpFpmMasterInis = $inis; + } + + public function setForceSapi($sapi) + { + $this->forceSapi = $sapi; + } + public function start() { if (!isset($this->envs['DD_TRACE_DEBUG'])) { @@ -176,7 +208,7 @@ public function start() $this->inis ); } else { - switch (\getenv('DD_TRACE_TEST_SAPI')) { + switch ($this->forceSapi ?? \getenv('DD_TRACE_TEST_SAPI')) { case 'cgi-fcgi': $this->sapi = new PhpCgi( self::FCGI_HOST, @@ -192,7 +224,12 @@ public function start() self::FCGI_HOST, self::FCGI_PORT, $this->envs, - $this->inis + $this->inis, + $this->phpFpmMaxChildren, + $this->phpFpmUser, + $this->phpFpmGroup, + $this->phpFpmSudo, + $this->phpFpmMasterInis ); break; case 'apache2handler': diff --git a/tests/ext/background-sender/sidecar_thread_mode_permissions.phpt b/tests/ext/background-sender/sidecar_thread_mode_permissions.phpt new file mode 100644 index 00000000000..09c8436402b --- /dev/null +++ b/tests/ext/background-sender/sidecar_thread_mode_permissions.phpt @@ -0,0 +1,27 @@ +--TEST-- +Thread mode sidecar uses abstract Unix socket +--SKIPIF-- + + + +--ENV-- +DD_TRACE_SIDECAR_CONNECTION_MODE=thread +DD_TRACE_GENERATE_ROOT_SPAN=0 +DD_INSTRUMENTATION_TELEMETRY_ENABLED=0 +--FILE-- + +--EXPECT-- +Sidecar uses abstract socket diff --git a/tests/ext/crashtracker_segfault.phpt b/tests/ext/crashtracker_segfault.phpt index 8101393693c..f1a2949727d 100644 --- a/tests/ext/crashtracker_segfault.phpt +++ b/tests/ext/crashtracker_segfault.phpt @@ -51,7 +51,7 @@ $rr->waitForRequest(function ($request) { if (!isset($payload["message"]["metadata"])) { break; } - if (($payload["message"]["kind"] ?? "") == "Crash ping") { + if (!isset($payload["message"]["os_info"])) { continue; } diff --git a/tests/ext/live-debugger/debugger_span_decoration_probe.phpt b/tests/ext/live-debugger/debugger_span_decoration_probe.phpt index 9716393f6d7..e325910d42d 100644 --- a/tests/ext/live-debugger/debugger_span_decoration_probe.phpt +++ b/tests/ext/live-debugger/debugger_span_decoration_probe.phpt @@ -98,7 +98,7 @@ array(2) { ["_dd.di.ret.probe_id"]=> string(1) "3" } -string(%d) "/debugger/v1/input?ddtags=debugger_version:1.%s,env:none,version:,runtime_id:%s-%s-%s-%s-%s,host_name:%s" +string(%d) "/debugger/v1/diagnostics?ddtags=debugger_version:1.%s,env:none,version:,runtime_id:%s-%s-%s-%s-%s,host_name:%s" array(1) { [0]=> array(6) { diff --git a/tests/ext/pcntl/pcntl_fork_thread_mode_orphan.phpt b/tests/ext/pcntl/pcntl_fork_thread_mode_orphan.phpt new file mode 100644 index 00000000000..1cb0766e149 --- /dev/null +++ b/tests/ext/pcntl/pcntl_fork_thread_mode_orphan.phpt @@ -0,0 +1,40 @@ +--TEST-- +Thread mode sidecar: orphaned child process promotes itself to master after parent exits +--SKIPIF-- + + + +--ENV-- +DD_TRACE_SIDECAR_CONNECTION_MODE=thread +DD_TRACE_GENERATE_ROOT_SPAN=0 +DD_INSTRUMENTATION_TELEMETRY_ENABLED=0 +LSAN_OPTIONS=detect_leaks=0 +--FILE-- + 0) { + exit(0); +} + +usleep(500000); // 500ms + +// Creating and flushing a span triggers ddtrace_sidecar_ensure_active() +$span = DDTrace\start_span(); +$span->name = 'orphaned-child-span'; +DDTrace\close_span(); + +echo "Child span submitted\n"; +exit(0); + +?> +--EXPECT-- +Child span submitted diff --git a/tests/ext/sidecar_connection_mode_auto.phpt b/tests/ext/sidecar_connection_mode_auto.phpt new file mode 100644 index 00000000000..449899f8d29 --- /dev/null +++ b/tests/ext/sidecar_connection_mode_auto.phpt @@ -0,0 +1,24 @@ +--TEST-- +Sidecar connection in auto mode (default) +--SKIPIF-- + +--ENV-- +DD_TRACE_SIDECAR_CONNECTION_MODE=auto +DD_INSTRUMENTATION_TELEMETRY_ENABLED=0 +DD_TRACE_SIDECAR_TRACE_SENDER=1 +--FILE-- + +--EXPECT-- +Connection mode: auto +Span created successfully diff --git a/tests/ext/sidecar_connection_mode_config.phpt b/tests/ext/sidecar_connection_mode_config.phpt new file mode 100644 index 00000000000..b7ae94580fd --- /dev/null +++ b/tests/ext/sidecar_connection_mode_config.phpt @@ -0,0 +1,16 @@ +--TEST-- +DD_TRACE_SIDECAR_CONNECTION_MODE configuration parsing +--SKIPIF-- + +--ENV-- +DD_TRACE_SIDECAR_CONNECTION_MODE=subprocess +--FILE-- + +--EXPECT-- +Test 1: subprocess mode +string(10) "subprocess" diff --git a/tests/ext/sidecar_connection_mode_invalid.phpt b/tests/ext/sidecar_connection_mode_invalid.phpt new file mode 100644 index 00000000000..69db7138f94 --- /dev/null +++ b/tests/ext/sidecar_connection_mode_invalid.phpt @@ -0,0 +1,24 @@ +--TEST-- +Invalid sidecar connection mode falls back to auto +--SKIPIF-- + +--ENV-- +DD_TRACE_SIDECAR_CONNECTION_MODE=invalid_mode +DD_INSTRUMENTATION_TELEMETRY_ENABLED=0 +DD_TRACE_SIDECAR_TRACE_SENDER=1 +--FILE-- + +--EXPECT-- +Connection mode: auto +Span created successfully diff --git a/tests/ext/sidecar_connection_mode_subprocess.phpt b/tests/ext/sidecar_connection_mode_subprocess.phpt new file mode 100644 index 00000000000..fb10c7a87c5 --- /dev/null +++ b/tests/ext/sidecar_connection_mode_subprocess.phpt @@ -0,0 +1,24 @@ +--TEST-- +Sidecar connection in subprocess mode +--SKIPIF-- + +--ENV-- +DD_TRACE_SIDECAR_CONNECTION_MODE=subprocess +DD_INSTRUMENTATION_TELEMETRY_ENABLED=0 +DD_TRACE_SIDECAR_TRACE_SENDER=1 +--FILE-- + +--EXPECT-- +Connection mode: subprocess +Span created successfully