diff --git a/.gitignore b/.gitignore index 05173524..75feb22b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,57 +1,39 @@ -# Prerequisites -*.d - -# Compiled Object files -*.slo -*.lo -*.o -*.obj - -# Precompiled Headers -*.gch -*.pch - -# Compiled Dynamic libraries -*.so -*.dylib +*.a +*.app +*.bak *.dll - -# Fortran module files -*.mod -*.smod - -# Compiled Static libraries -*.lai +*.dylib +*.exe *.la -*.a +*.lai *.lib - -# Executables -*.exe +*.lo +*.log +*.o +*.obj *.out -*.app - -.DS_Store +*.slo +*.so .cache/ +.claude/ .vscode/ +.DS_Store +compile_commands.json + +__pycache__/ +build-rum/ build/ httpd-*/ -__pycache__/ +httpd/ venv/ -compile_commands.json -build-rum/ -*.bak - -# Integration tests -test/integration-test/.venv/ -test/integration-test/uv.lock -test/integration-test/.pytest_cache/ test/integration-test/.coverage +test/integration-test/.pytest_cache/ +test/integration-test/.venv/ +test/integration-test/*.conf.tmp test/integration-test/htmlcov/ test/integration-test/log-*/ test/integration-test/logs/ -test/integration-test/*.conf.tmp -test/integration-test/*.log +test/integration-test/uv.lock diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aad1aec2..c2dce0f9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Contributing +# Contributing ## Fork, Clone, Branch and Create your PR @@ -8,7 +8,7 @@ git submodule update --init --recursive ``` ### Rules -- **Follow the pattern of what you already see in the code.** +- Follow the pattern of what you already see in the code. - Follow the coding style. # Development @@ -27,37 +27,19 @@ Once you got a valid `python` installation, install all the dependencies with pip install -r requirements.txt ```` -Finally, you need HTTPD source code available. Use [scripts/setup-httpd.py](./scripts/setup-httpd.py) script: - -````shell -python scripts/setup-httpd.py - -usage: Download Apache HTTP Server and its dependencies [-h] [-v VERBOSE] [-o OUTPUT] version - -positional arguments: - version HTTPD version to download - -options: - -h, --help show this help message and exit - -v VERBOSE, --verbose VERBOSE - Increase verbosity level - -o OUTPUT, --output OUTPUT - Directory where HTTPD will be extracted -```` - ## Compiling ### Setup `httpd` -In order to build the module you have to configure httpd first: +In order to build the module you have to configure `httpd` with the [scripts/setup-httpd.py](./scripts/setup-httpd.py) script: + ```sh python scripts/setup-httpd.py -o httpd $HTTPD_VERSION -cd httpd - -./configure --with-included-apr --prefix=$(pwd)/httpd-build --enable-mpms-shared="all" +cd httpd +./configure --with-included-apr --prefix=$(pwd)/httpd-build --enable-mpms-shared="all" ``` -### Build the module +### Build the Module CMake is our build system. If you are not familiar with CMake, read [the tutorial.](https://cmake.org/cmake/help/latest/guide/tutorial/index.html) @@ -69,12 +51,9 @@ cmake --build build -j ``` ### Testing -For now there are only integration tests. `docker-compose` orchestrate a runtime environment and the test suite interact with -It should be as simple as: -````sh -pytest test/integration-test -```` -## How to debug -Run with `-X` +For now there are only [integration tests](./test/integration-test/). + +## How to Debug +Run with `-X`. diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index ea379c2a..1181b4dc 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -1 +1,6 @@ add_subdirectory(dd-trace-cpp) + +# Force POSITION_INDEPENDENT_CODE (PIC) because mod_datadog.so is loaded via +# dlopen, but dd-trace-cpp sets this based on BUILD_SHARED_LIBS, whereas we +# link with the static library. +set_target_properties(dd-trace-cpp-objects PROPERTIES POSITION_INDEPENDENT_CODE ON) diff --git a/deps/dd-trace-cpp b/deps/dd-trace-cpp index a7d71b5e..14280afb 160000 --- a/deps/dd-trace-cpp +++ b/deps/dd-trace-cpp @@ -1 +1 @@ -Subproject commit a7d71b5e0599125d5957f7b8d3d56f0bcc6ae485 +Subproject commit 14280afb9960c052655601b2e7b0856f376f4b86 diff --git a/mod_datadog/CMakeLists.txt b/mod_datadog/CMakeLists.txt index c53c0696..92da67b6 100644 --- a/mod_datadog/CMakeLists.txt +++ b/mod_datadog/CMakeLists.txt @@ -79,7 +79,7 @@ target_compile_options(mod_datadog PRIVATE -Wall -Wextra ) -add_dependencies(mod_datadog dd_trace_cpp-static httpd fmt) +add_dependencies(mod_datadog dd-trace-cpp-static httpd fmt) target_include_directories( mod_datadog @@ -97,10 +97,10 @@ set_target_properties( target_include_directories(mod_datadog PRIVATE httpd) -target_link_libraries(mod_datadog +target_link_libraries(mod_datadog PRIVATE - dd_trace_cpp-static - httpd + dd-trace-cpp-static + httpd fmt ) diff --git a/mod_datadog/src/mod_datadog.cpp b/mod_datadog/src/mod_datadog.cpp index 592250a4..2ed8762f 100644 --- a/mod_datadog/src/mod_datadog.cpp +++ b/mod_datadog/src/mod_datadog.cpp @@ -292,7 +292,7 @@ void init_tracer(datadog::tracing::TracerConfig& tracer_conf) { // default value when no service name has been provided. auto& service_name_metadata = validated_config->metadata[datadog::tracing::ConfigName::SERVICE_NAME]; - service_name_metadata.origin = + service_name_metadata.back().origin = datadog::tracing::ConfigMetadata::Origin::DEFAULT; } diff --git a/test/integration-test/.env.example b/test/integration-test/.env.example index d98f83fd..ef25469c 100644 --- a/test/integration-test/.env.example +++ b/test/integration-test/.env.example @@ -5,10 +5,6 @@ # # Then source it before running tests: # source .env -# make test - -# Path to Apache apachectl binary -HTTPD_BIN_PATH=/usr/local/apache2/bin/apachectl # Path to compiled mod_datadog.so module HTTPD_MODULE_PATH=/path/to/mod_datadog.so