Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
8c942a0
feat(profiling): publish Linux OTel contexts
morrisonlevi Jul 29, 2026
f57acd4
feat(appsec): consume Linux OTel contexts
morrisonlevi Jul 30, 2026
29841a6
Revert "feat(appsec): consume Linux OTel contexts"
morrisonlevi Jul 30, 2026
e719b9a
fix(ci): preserve Linux exports in debug relinking
morrisonlevi Jul 30, 2026
8d01de4
fix(ci): package OTel thread context crate for PECL
morrisonlevi Jul 30, 2026
7023e5d
fix(otel): keep request metadata in thread context
morrisonlevi Jul 30, 2026
735982f
fix: use lossy UTF8 conversions on process ctx
morrisonlevi Jul 31, 2026
27c0cc2
feat(otel): publish thread context from tracer
morrisonlevi Jul 31, 2026
eb61795
perf(otel): resolve TLS slot when creating roots
morrisonlevi Aug 1, 2026
4a99a69
fix(profiling): pthread_self/gettid mismatch
morrisonlevi Aug 3, 2026
ec7721a
Merge remote-tracking branch 'origin/master' into feat/otel-context
morrisonlevi Aug 3, 2026
99ca0f1
build: use one .sym file
morrisonlevi Aug 3, 2026
bbe1256
Merge remote-tracking branch 'origin/master' into feat/otel-context
morrisonlevi Aug 4, 2026
facef41
fix(ci): export OTel TLS symbol from SSI library
morrisonlevi Aug 4, 2026
d2c2ddb
test(otel): account for PHP 8.5 compatibility gaps
morrisonlevi Aug 4, 2026
e6ac755
Revert "test(otel): account for PHP 8.5 compatibility gaps"
morrisonlevi Aug 4, 2026
5d4a025
Merge remote-tracking branch 'origin/master' into feat/otel-context
morrisonlevi Aug 4, 2026
e23e7ba
Merge remote-tracking branch 'origin/master' into feat/otel-context
morrisonlevi Aug 4, 2026
559b249
build: use Clang for CentOS sidecar jobs
morrisonlevi Aug 4, 2026
e86b98d
Merge remote-tracking branch 'origin/master' into feat/otel-context
morrisonlevi Aug 4, 2026
faa11dd
test(profiling): isolate process context cache
morrisonlevi Aug 4, 2026
f2a9926
test(otel): skip process context fork test under Valgrind
morrisonlevi Aug 5, 2026
59db525
refactor(otel): define thread context TLS in tracer
morrisonlevi Aug 5, 2026
532672b
refactor(otel): build process identity in Rust
morrisonlevi Aug 5, 2026
29ebb0b
refactor(profiling): borrow cached process identity
morrisonlevi Aug 5, 2026
4764b0b
refactor(profiling): carry identity on all platforms
morrisonlevi Aug 5, 2026
879c6ec
refactor(profiling): inline process context refresh
morrisonlevi Aug 5, 2026
bc6a66e
refactor(otel): simplify attribute generation update
morrisonlevi Aug 5, 2026
3d38747
refactor(otel): only detach thread context after fork
morrisonlevi Aug 5, 2026
dfac14f
refactor(tracing): release traceparent after parsing
morrisonlevi Aug 5, 2026
79ada60
fix(tracing): preserve flags when changing trace ID
morrisonlevi Aug 5, 2026
1901f6f
docs(otel): explain attribute refresh generation
morrisonlevi Aug 5, 2026
15ab88e
refactor(otel): use default target metadata helper
morrisonlevi Aug 5, 2026
f6f6670
fix(otel): preserve context across stack transitions
morrisonlevi Aug 5, 2026
76d1d6f
Merge remote-tracking branch 'origin/master' into feat/otel-context
morrisonlevi Aug 6, 2026
fd8222e
test(profiling): avoid needless option dereference
morrisonlevi Aug 6, 2026
dac4655
perf(profiling): outline process context refresh
morrisonlevi Aug 6, 2026
e542002
fix(profiling): back off process context refreshes
morrisonlevi Aug 6, 2026
5169687
style(profiling): cargo +nightly fmt
morrisonlevi Aug 6, 2026
95da8df
fix: otel_process_context_publish
morrisonlevi Aug 6, 2026
dfa28ad
refactor(otel): publish process context directly
morrisonlevi Aug 6, 2026
d151e8b
fix(otel): correct OpenTelemetry module dependency name
morrisonlevi Aug 6, 2026
e224882
fix(profiling): discover OTel context providers
morrisonlevi Aug 6, 2026
0c59714
Merge remote-tracking branch 'origin/master' into feat/otel-context
morrisonlevi Aug 6, 2026
acf8c35
Merge remote-tracking branch 'origin/master' into feat/otel-context
morrisonlevi Aug 6, 2026
d493905
refactor(profiling): store profile tags in segments
morrisonlevi Aug 7, 2026
5aa3f3f
perf(profiling): inline unified service tag offsets
morrisonlevi Aug 7, 2026
c2a13fa
perf(profiling): compare serialized tag identity
morrisonlevi Aug 7, 2026
63911c5
Merge branch 'master' into feat/otel-context
morrisonlevi Aug 10, 2026
50b23c9
fix(sidecar): regenerate instance id during fork handling
morrisonlevi Aug 10, 2026
a912385
Merge remote-tracking branch 'origin/feat/otel-context' into feat/ote…
morrisonlevi Aug 10, 2026
8ccd266
fix(components): initialize new telemetry fields
morrisonlevi Aug 10, 2026
cc1b440
fix(appsec): support alternative tracer build on macOS
morrisonlevi Aug 10, 2026
5bc344d
fix(telemetry): update integration expectations
morrisonlevi Aug 10, 2026
8825524
fix(tracing): scope OTel attributes to entrypoint lifecycle
morrisonlevi Aug 10, 2026
a463f31
fix(appsec): require GNU2 TLS on x86-64 Linux
morrisonlevi Aug 10, 2026
5871765
perf(profiling): cache decoded OTel thread context
morrisonlevi Aug 11, 2026
1e39c24
fix(telemetry): update dependency expectation
morrisonlevi Aug 11, 2026
2320ed6
build(deps): update libdatadog to latest main
morrisonlevi Aug 11, 2026
c6957f9
Merge remote-tracking branch 'origin' into feat/otel-context
morrisonlevi Aug 14, 2026
3c8d862
fix: otel process ctx init/detach
morrisonlevi Aug 14, 2026
dcd51ac
build(deps): update libdatadog to v41.0.0
morrisonlevi Aug 14, 2026
055e6ae
refactor(otel): rely on libdatadog resource filtering
morrisonlevi Aug 14, 2026
6f99062
refactor(otel): clarify atomic field updates
morrisonlevi Aug 14, 2026
a0edf86
fix(packaging): include feature evaluation crate in PECL
morrisonlevi Aug 14, 2026
f2e8f77
fix(telemetry): stabilize logs metric integration test
morrisonlevi Aug 14, 2026
0b78054
test: add needed trailing whitespace
morrisonlevi Aug 14, 2026
6501b2a
build: regenerate libdatadog headers
morrisonlevi Aug 14, 2026
68d44dd
fix: switching span stack issue
morrisonlevi Aug 14, 2026
cb22676
refactor(tracing): use ZEND_ASSERT instead of if
morrisonlevi Aug 14, 2026
5b06fba
fix(appsec): add missing rate metric
morrisonlevi Aug 14, 2026
cbd2d75
Merge remote-tracking branch 'origin/master' into feat/otel-context
morrisonlevi Aug 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitlab/build-sidecar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ fi

SHARED=1 PROFILE=tracer-release host_os="${HOST_OS}" ./compile_rust.sh
cp -v "${CARGO_TARGET_DIR:-target}/tracer-release/libdatadog_php.a" "libdatadog_php_$(uname -m)${suffix}.a"
objcopy --compress-debug-sections "${CARGO_TARGET_DIR:-target}/tracer-release/libdatadog_php.so" "libdatadog_php_$(uname -m)${suffix}.so"
output="libdatadog_php_$(uname -m)${suffix}.so"
objcopy --compress-debug-sections "${CARGO_TARGET_DIR:-target}/tracer-release/libdatadog_php.so" "${output}"
7 changes: 6 additions & 1 deletion .gitlab/compile_extension.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@ make -j static &
wait

# Link extension
sed -i 's/-export-symbols .*\/datadog\.sym/-Wl,--retain-symbols-file=datadog.sym/g' ${EXTENSION_DIR}/ddtrace.ldflags
if [ "$(uname -s)" = "Linux" ]; then
export_symbols_file="datadog-linux.sym"
else
export_symbols_file="datadog.sym"
fi
sed -i -E "s#-export-symbols [^ ]+#-Wl,--retain-symbols-file=${export_symbols_file}#g" "${EXTENSION_DIR}/ddtrace.ldflags"
cc -shared -Wl,-whole-archive ${MODULES_DIR}/ddtrace.a -Wl,-no-whole-archive $(cat ${EXTENSION_DIR}/ddtrace.ldflags) ${CARGO_TARGET_DIR}/debug/libdatadog_php.a -Wl,-soname -Wl,ddtrace.so -o ${MODULES_DIR}/ddtrace.so
6 changes: 5 additions & 1 deletion .gitlab/link-tracing-extension.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ set -e -o pipefail

suffix="${1:-}"

sed -i 's/-export-symbols .*\/datadog\.sym/-Wl,--retain-symbols-file=datadog.sym/g' "ddtrace_$(uname -m)${suffix}.ldflags"
export_symbols_file="datadog.sym"
if [ "$(uname -s)" = "Linux" ]; then
export_symbols_file="datadog-linux.sym"
fi
sed -i -E "s#-export-symbols [^ ]+#-Wl,--retain-symbols-file=${export_symbols_file}#g" "ddtrace_$(uname -m)${suffix}.ldflags"
pids=()
for archive in extensions_$(uname -m)/*.a; do
(
Expand Down
83 changes: 49 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 17 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,30 @@ inherits = "release"
# #2253 consolidated `anyhow`, `serde`, `tokio` and `tracing` to the workspace
# level, so they are mirrored here too.
[workspace.dependencies]
allocator-api2 = { version = "0.2.21", default-features = false }
anyhow = { version = "1.0", default-features = false }
arc-swap = "1.7.1"
hyper = { version = "1.6", features = [
"http1",
"client",
], default-features = false }
hyper-util = { version = "0.1.10", features = [
"http1",
"client",
"client-legacy",
] }
arc-swap = { version = "1.7.1", default-features = false }
bolero = { version = "0.13.4", default-features = false }
chrono = { version = "0.4.38", default-features = false }
clap = { version = "4.3.21", default-features = false }
criterion = { version = "0.5.1", default-features = true }
cxx-build = { version = "1.0", default-features = false }
elf = { version = "0.7", default-features = false }
futures = { version = "0.3", default-features = false }
hyper = { version = "1.6", default-features = false }
hyper-util = { version = "0.1.10", default-features = false }
io-lifetimes = { version = "1.0", default-features = false }
libc = { version = "0.2", default-features = true }
prost-build = { version = "0.14.1", default-features = false }
protoc-bin-vendored = { version = "3.0.0", default-features = false }
rustls = { version = "0.23", default-features = false }
serde = { version = "1.0", default-features = false }
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
syn = { version = "^2", default-features = false }
tempfile = { version = "3.13", default-features = false, features = ["getrandom"] }
tokio = { version = "1.36", default-features = false }
tracing = { version = "0.1", default-features = false }
uuid = { version = "1.7.0", default-features = false }

[workspace.lints]
# empty for compat with libdatadog
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 tracer 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,libdd-remote-config,datadog-sidecar,datadog-sidecar-ffi,datadog-sidecar-macros,libdd-alloc,libdd-capabilities,libdd-capabilities-impl,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-shared-runtime,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,libdd-ffe,datadog-ipc,datadog-ipc-macros,datadog-live-debugger,datadog-live-debugger-ffi,libdd-remote-config,datadog-sidecar,datadog-sidecar-ffi,datadog-sidecar-macros,libdd-alloc,libdd-capabilities,libdd-capabilities-impl,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-otel-thread-ctx,libdd-shared-runtime,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 }' )
Expand Down Expand Up @@ -106,7 +106,7 @@ JUNIT_RESULTS_DIR := $(shell pwd)

all: $(BUILD_DIR)/configure $(SO_FILE)

$(BUILD_DIR)/configure: $(M4_FILES) $(BUILD_DIR)/datadog.sym $(BUILD_DIR)/VERSION
$(BUILD_DIR)/configure: $(M4_FILES) $(BUILD_DIR)/datadog.sym $(BUILD_DIR)/datadog-linux.sym $(BUILD_DIR)/VERSION
$(Q) (cd $(BUILD_DIR); phpize && $(SED_I) 's/\/FAILED/\/\\bFAILED/' $(BUILD_DIR)/run-tests.php) # Fix PHP 5.4 exit code bug when running selected tests (FAILED vs XFAILED)

$(BUILD_DIR)/run-tests.php: $(if $(ASSUME_COMPILED),, $(BUILD_DIR)/configure)
Expand Down
23 changes: 20 additions & 3 deletions appsec/cmake/ddtrace.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
include(ExternalProject)

set(CARGO_BUILD_CMD "cargo build")
if(DD_APPSEC_SSI)
set(CARGO_BUILD_CMD "cargo build")
else()
# Only the static library is linked into ddtrace. Building the cdylib as well fails on macOS
# because it references symbols that are provided by the final ddtrace extension.
set(CARGO_BUILD_CMD "cargo rustc --lib --crate-type staticlib")
endif()
set(CARGO_BUILD_ENV "") # Initialize to empty


Expand All @@ -26,9 +32,9 @@ add_custom_target(libdatadog_stamp
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(EXPORTS_FILE "${CMAKE_BINARY_DIR}/ddtrace_exports.version")
add_custom_target(ddtrace_exports
COMMAND bash -c "{ echo -e '{\\nglobal:'; sed 's/$/;/' '${CMAKE_SOURCE_DIR}'/../datadog.sym; echo -e 'local:\\n*;\\n};'; } > '${EXPORTS_FILE}'"
COMMAND bash -c "{ echo -e '{\\nglobal:'; sed 's/$/;/' '${CMAKE_SOURCE_DIR}'/../datadog-linux.sym; echo -e 'local:\\n*;\\n};'; } > '${EXPORTS_FILE}'"
BYPRODUCTS ${EXPORTS_FILE}
DEPENDS ${CMAKE_SOURCE_DIR}/../datadog.sym
DEPENDS ${CMAKE_SOURCE_DIR}/../datadog-linux.sym
VERBATIM
)
elseif(APPLE)
Comment thread
morrisonlevi marked this conversation as resolved.
Expand Down Expand Up @@ -137,6 +143,9 @@ if (PhpConfig_VERNUM LESS 80100)
list(REMOVE_ITEM FILES_DDTRACE "${CMAKE_SOURCE_DIR}/../tracer/handlers_fiber.c")
endif()
list(REMOVE_ITEM FILES_DDTRACE "${CMAKE_SOURCE_DIR}/../ext/crashtracking_windows.c")
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(REMOVE_ITEM FILES_DDTRACE "${CMAKE_SOURCE_DIR}/../tracer/otel_context.c")
endif()

find_package(CURL REQUIRED)
message(STATUS "CURL version: ${CURL_VERSION_STRING}")
Expand All @@ -153,6 +162,14 @@ target_compile_options(ddtrace PRIVATE -fms-extensions -Wno-microsoft-anon-tag)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_compile_definitions(ddtrace PRIVATE _GNU_SOURCE)
target_link_options(ddtrace PRIVATE "-Wl,--version-script=${EXPORTS_FILE}")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64)$")
include(CheckCCompilerFlag)
check_c_compiler_flag("-mtls-dialect=gnu2" COMPILER_HAS_GNU2_TLS_DIALECT)
if(NOT COMPILER_HAS_GNU2_TLS_DIALECT)
message(FATAL_ERROR "x86-64 Linux OTel context sharing requires compiler support for -mtls-dialect=gnu2")
endif()
target_compile_options(ddtrace PRIVATE -mtls-dialect=gnu2)
endif()
elseif(APPLE)
target_link_options(ddtrace PRIVATE "-exported_symbols_list" "${EXPORTS_FILE}")
else()
Expand Down
2 changes: 2 additions & 0 deletions appsec/src/helper/service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ template <> struct fmt::formatter<ddog_MetricType> {
return fmt::format_to(ctx.out(), "COUNT");
case DDOG_METRIC_TYPE_DISTRIBUTION:
return fmt::format_to(ctx.out(), "DISTRIBUTION");
case DDOG_METRIC_TYPE_RATE:
return fmt::format_to(ctx.out(), "RATE");
}
return fmt::format_to(ctx.out(), "UNKNOWN");
}
Expand Down
Loading
Loading