Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note about cargo in README, make debug symbols included by default for manual compilation #2110

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUN_TESTS_CMD := REPORT_EXIT_STATUS=1 TEST_PHP_SRCDIR=$(PROJECT_ROOT) USE_TRACKE

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 'CONFLICTS' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' )
RUST_FILES = $(BUILD_DIR)/Cargo.toml $(shell find components-rs -name '*.c' -o -name '*.rs' -o -name 'Cargo.toml' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' ) $(shell find libdatadog/{ddcommon,ddcommon-ffi,ddtelemetry,ddtelemetry-ffi,ipc,sidecar,sidecar-ffi,spawn_worker,tools/{cc_utils,sidecar_mockgen},Cargo.toml} -type f \( -path "*/src*" -o -path "*Cargo.toml" -o -path "*/build.rs" \) -not -path "*/ipc/build.rs" -not -path "*/sidecar-ffi/build.rs")
RUST_FILES = $(BUILD_DIR)/Cargo.toml $(shell find components-rs -name '*.c' -o -name '*.rs' -o -name 'Cargo.toml' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' ) $(shell find libdatadog/{ddcommon,ddcommon-ffi,ddtelemetry,ddtelemetry-ffi,ipc,sidecar,sidecar-ffi,spawn_worker,tools/{cc_utils,sidecar_mockgen},Cargo.toml} -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 "*/ipc/build.rs" -not -path "*/sidecar-ffi/build.rs")
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 }' )
INIT_HOOK_TEST_FILES = $(shell find tests/C2PHP -name '*.phpt' -o -name '*.inc' | awk '{ printf "$(BUILD_DIR)/%s\n", $$1 }' )
Expand Down Expand Up @@ -85,7 +85,7 @@ $(BUILD_DIR)/configure: $(M4_FILES) $(BUILD_DIR)/ddtrace.sym
$(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)/Makefile: $(BUILD_DIR)/configure
$(Q) (cd $(BUILD_DIR); ./configure --enable-ddtrace-rust-symbols=$(if $(RUST_DEBUG_SYMBOLS),yes,no))
$(Q) (cd $(BUILD_DIR); ./configure --enable-ddtrace-rust-debug=$(if $(RUST_DEBUG_SYMBOLS),yes,no) --enable-ddtrace-rust-symbols=$(if $(RUST_DEBUG_SYMBOLS),yes,no))

$(SO_FILE): $(C_FILES) $(RUST_FILES) $(BUILD_DIR)/Makefile
$(Q) $(MAKE) -C $(BUILD_DIR) -j CFLAGS="$(CFLAGS)$(if $(ASAN), -fsanitize=address)" LDFLAGS="$(LDFLAGS)$(if $(ASAN), -fsanitize=address)"
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Datadog’s PHP Tracing Library supports many of the most common PHP versions, P

Visit the [PHP tracer documentation](https://docs.datadoghq.com/tracing/languages/php/) for complete installation instructions.

#### Installation from PECL (datadog_trace) or from source

Compilation of the tracer and the profiler requires cargo to be installed. Ensure that cargo is minimum version 1.64.0, otherwise follow the [official instructions for installing cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html).

### Advanced configuration

For more information about configuring and instrumenting **ddtrace**, view the [configuration documentation](https://docs.datadoghq.com/tracing/setup/php/#configuration).
Expand Down
9 changes: 6 additions & 3 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ PHP_ARG_WITH(ddtrace-sanitize, whether to enable AddressSanitizer for ddtrace,
PHP_ARG_WITH(ddtrace-cargo, where cargo is located for rust code compilation,
[ --with-ddtrace-cargo Location to cargo binary for rust compilation], cargo, not found)

PHP_ARG_ENABLE(ddtrace-rust-symbols, whether to compile rust in debug mode,
[ --enable-ddtrace-rust-symbols Build with debug symbols included in the rust archive], [[$(test "${CFLAGS#*-g}" != "${CFLAGS}" && test "${CFLAGS#*-g0}" == "${CFLAGS}" && echo yes || echo no)]], [no])
PHP_ARG_ENABLE(ddtrace-rust-debug, whether to compile rust in debug mode,
[ --enable-ddtrace-rust-debug Build rust code in debug mode (significantly slower)], [[$(test "${CFLAGS#*-g}" != "${CFLAGS}" && test "${CFLAGS#*-g0}" == "${CFLAGS}" && echo yes || echo no)]], [no])

PHP_ARG_ENABLE(ddtrace-rust-symbols, whether to keep rust debug symbols,
[ --disable-ddtrace-rust-symbols Strip debug symbols from the rust archive (significantly reduces artifact size)], [yes], [yes])

if test "$PHP_DDTRACE" != "no"; then
AC_CHECK_SIZEOF([long])
Expand Down Expand Up @@ -274,7 +277,7 @@ if test "$PHP_DDTRACE" != "no"; then

cat <<EOT >> Makefile.fragments
\$(builddir)/target/$ddtrace_cargo_profile/libddtrace_php.a: $( (find "$ext_srcdir/components-rs" -name "*.c" -o -name "*.rs" -o -name "Cargo.toml"; find "$ext_srcdir/../../libdatadog" -name "*.rs" -exclude "target"; find "$ext_srcdir/libdatadog" -name "*.rs" -exclude "target"; echo "$all_object_files" ) | xargs )
(cd "$ext_srcdir/components-rs"; $ddtrace_mock_sources CARGO_TARGET_DIR=\$(builddir)/target/ \$(DDTRACE_CARGO) build $(test "$ddtrace_cargo_profile" == debug || echo --profile tracer-release) && test "$ddtrace_cargo_profile" == debug || strip -d \$(builddir)/target/$ddtrace_cargo_profile/libddtrace_php.a)
(cd "$ext_srcdir/components-rs"; $ddtrace_mock_sources CARGO_TARGET_DIR=\$(builddir)/target/ \$(DDTRACE_CARGO) build $(test "$ddtrace_cargo_profile" == debug || echo --profile tracer-release) && test "$PHP_DDTRACE_RUST_SYMBOLS" == no || strip -d \$(builddir)/target/$ddtrace_cargo_profile/libddtrace_php.a)
EOT

if test "$ext_shared" = "shared" || test "$ext_shared" = "yes"; then
Expand Down
2 changes: 1 addition & 1 deletion libdatadog
Submodule libdatadog updated 72 files
+2 −2 .github/workflows/lint.yml
+183 −2 Cargo.lock
+211 −565 LICENSE-3rdparty.yml
+1 −1 ipc/Cargo.toml
+70 −0 ipc/tarpc/.github/workflows/main.yml
+7 −0 ipc/tarpc/.gitignore
+27 −0 ipc/tarpc/CONTRIBUTING.md
+11 −0 ipc/tarpc/Cargo.toml
+9 −0 ipc/tarpc/LICENSE
+171 −0 ipc/tarpc/README.md
+472 −0 ipc/tarpc/RELEASES.md
+40 −0 ipc/tarpc/example-service/Cargo.toml
+52 −0 ipc/tarpc/example-service/src/client.rs
+34 −0 ipc/tarpc/example-service/src/lib.rs
+77 −0 ipc/tarpc/example-service/src/server.rs
+113 −0 ipc/tarpc/hooks/pre-commit
+103 −0 ipc/tarpc/hooks/pre-push
+34 −0 ipc/tarpc/plugins/Cargo.toml
+9 −0 ipc/tarpc/plugins/LICENSE
+1 −0 ipc/tarpc/plugins/rustfmt.toml
+825 −0 ipc/tarpc/plugins/src/lib.rs
+144 −0 ipc/tarpc/plugins/tests/server.rs
+85 −0 ipc/tarpc/plugins/tests/service.rs
+114 −0 ipc/tarpc/tarpc/Cargo.toml
+9 −0 ipc/tarpc/tarpc/LICENSE
+1 −0 ipc/tarpc/tarpc/README.md
+1 −0 ipc/tarpc/tarpc/clippy.toml
+128 −0 ipc/tarpc/tarpc/examples/compression.rs
+48 −0 ipc/tarpc/tarpc/examples/custom_transport.rs
+358 −0 ipc/tarpc/tarpc/examples/pubsub.rs
+55 −0 ipc/tarpc/tarpc/examples/readme.rs
+112 −0 ipc/tarpc/tarpc/examples/tracing.rs
+1 −0 ipc/tarpc/tarpc/rustfmt.toml
+49 −0 ipc/tarpc/tarpc/src/cancellations.rs
+883 −0 ipc/tarpc/tarpc/src/client.rs
+134 −0 ipc/tarpc/tarpc/src/client/in_flight_requests.rs
+171 −0 ipc/tarpc/tarpc/src/context.rs
+421 −0 ipc/tarpc/tarpc/src/lib.rs
+672 −0 ipc/tarpc/tarpc/src/serde_transport.rs
+1,199 −0 ipc/tarpc/tarpc/src/server.rs
+221 −0 ipc/tarpc/tarpc/src/server/in_flight_requests.rs
+49 −0 ipc/tarpc/tarpc/src/server/incoming.rs
+5 −0 ipc/tarpc/tarpc/src/server/limits.rs
+480 −0 ipc/tarpc/tarpc/src/server/limits/channels_per_key.rs
+349 −0 ipc/tarpc/tarpc/src/server/limits/requests_per_channel.rs
+140 −0 ipc/tarpc/tarpc/src/server/testing.rs
+113 −0 ipc/tarpc/tarpc/src/server/tokio.rs
+269 −0 ipc/tarpc/tarpc/src/trace.rs
+40 −0 ipc/tarpc/tarpc/src/transport.rs
+202 −0 ipc/tarpc/tarpc/src/transport/channel.rs
+71 −0 ipc/tarpc/tarpc/src/util.rs
+73 −0 ipc/tarpc/tarpc/src/util/serde.rs
+9 −0 ipc/tarpc/tarpc/tests/compile_fail.rs
+15 −0 ipc/tarpc/tarpc/tests/compile_fail/must_use_request_dispatch.rs
+11 −0 ipc/tarpc/tarpc/tests/compile_fail/must_use_request_dispatch.stderr
+9 −0 ipc/tarpc/tarpc/tests/compile_fail/serde_transport/must_use_tcp_connect.rs
+11 −0 ipc/tarpc/tarpc/tests/compile_fail/serde_transport/must_use_tcp_connect.stderr
+15 −0 ipc/tarpc/tarpc/tests/compile_fail/tarpc_server_missing_async.rs
+11 −0 ipc/tarpc/tarpc/tests/compile_fail/tarpc_server_missing_async.stderr
+6 −0 ipc/tarpc/tarpc/tests/compile_fail/tarpc_service_arg_pat.rs
+5 −0 ipc/tarpc/tarpc/tests/compile_fail/tarpc_service_arg_pat.stderr
+6 −0 ipc/tarpc/tarpc/tests/compile_fail/tarpc_service_fn_new.rs
+5 −0 ipc/tarpc/tarpc/tests/compile_fail/tarpc_service_fn_new.stderr
+6 −0 ipc/tarpc/tarpc/tests/compile_fail/tarpc_service_fn_serve.rs
+5 −0 ipc/tarpc/tarpc/tests/compile_fail/tarpc_service_fn_serve.stderr
+29 −0 ipc/tarpc/tarpc/tests/compile_fail/tokio/must_use_channel_executor.rs
+11 −0 ipc/tarpc/tarpc/tests/compile_fail/tokio/must_use_channel_executor.stderr
+30 −0 ipc/tarpc/tarpc/tests/compile_fail/tokio/must_use_server_executor.rs
+11 −0 ipc/tarpc/tarpc/tests/compile_fail/tokio/must_use_server_executor.stderr
+55 −0 ipc/tarpc/tarpc/tests/dataservice.rs
+275 −0 ipc/tarpc/tarpc/tests/service_functional.rs
+4 −1 tools/docker/Dockerfile.build