Skip to content
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
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ tests/internal/remoteconfig @DataDog/remote-config @DataDog/apm-core-pyt
# API SDK
ddtrace/trace/ @DataDog/apm-sdk-api-python
ddtrace/_trace/ @DataDog/apm-sdk-api-python
# File commonly updated for integrations, widen ownership to help with PR review
ddtrace/_trace/trace_handlers.py @DataDog/apm-sdk-api-python @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/opentelemetry/ @DataDog/apm-sdk-api-python
ddtrace/internal/opentelemetry @DataDog/apm-sdk-api-python
ddtrace/opentracer/ @DataDog/apm-sdk-api-python
Expand Down
118 changes: 42 additions & 76 deletions .github/workflows/build_python_3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.8'
- run: pip install cibuildwheel==2.22.0
python-version: "3.13"
- run: pip install cibuildwheel==2.23.3
- id: set-matrix
env:
CIBW_BUILD: ${{ inputs.cibw_build }}
Expand All @@ -50,102 +50,68 @@ jobs:
fail-fast: false
matrix:
include: ${{ fromJson(needs.build-wheels-matrix.outputs.include) }}
env:
CIBW_SKIP: ${{ inputs.cibw_skip }}
CIBW_PRERELEASE_PYTHONS: ${{ inputs.cibw_prerelease_pythons }}
CIBW_MUSLLINUX_I686_IMAGE: ghcr.io/datadog/dd-trace-py/pypa_musllinux_1_2_i686:latest
CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc
CIBW_BEFORE_ALL_MACOS: rustup target add aarch64-apple-darwin
CIBW_BEFORE_ALL_LINUX: |
if [[ "$(uname -m)-$(uname -i)-$(uname -o | tr '[:upper:]' '[:lower:]')-$(ldd --version 2>&1 | head -n 1 | awk '{print $1}')" != "i686-unknown-linux-musl" ]]; then
if command -v yum &> /dev/null; then
yum install -y libatomic.i686
fi
curl -sSf https://sh.rustup.rs | sh -s -- -y;
fi
CIBW_ENVIRONMENT_LINUX: PATH=$HOME/.cargo/bin:$PATH CMAKE_BUILD_PARALLEL_LEVEL=24 CMAKE_ARGS="-DNATIVE_TESTING=OFF"
# SYSTEM_VERSION_COMPAT is a workaround for versioning issue, a.k.a.
# `platform.mac_ver()` reports incorrect MacOS version at 11.0
# See: https://stackoverflow.com/a/65402241
CIBW_ENVIRONMENT_MACOS: CMAKE_BUILD_PARALLEL_LEVEL=24 SYSTEM_VERSION_COMPAT=0 CMAKE_ARGS="-DNATIVE_TESTING=OFF"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
python scripts/zip_filter.py {wheel} \*.c \*.cpp \*.cc \*.h \*.hpp \*.pyx \*.md &&
mkdir ./tempwheelhouse &&
unzip -l {wheel} | grep '\.so' &&
auditwheel repair -w ./tempwheelhouse {wheel} &&
mv ./tempwheelhouse/*.whl {dest_dir} &&
rm -rf ./tempwheelhouse
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
python scripts/zip_filter.py {wheel} \*.c \*.cpp \*.cc \*.h \*.hpp \*.pyx \*.md &&
MACOSX_DEPLOYMENT_TARGET=12.7 delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: python scripts/zip_filter.py "{wheel}" "*.c" "*.cpp" "*.cc" "*.h" "*.hpp" "*.pyx" "*.md" && mv "{wheel}" "{dest_dir}"
CIBW_TEST_COMMAND: "python {project}/tests/smoke_test.py"

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# Include all history and tags
with:
persist-credentials: false
fetch-depth: 0

- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
if: matrix.os != 'ubuntu-24.04-arm'
name: Install Python
with:
python-version: '3.8'
python-version: "3.13"

- name: Set up QEMU
if: runner.os == 'Linux' && matrix.os != 'ubuntu-24.04-arm'
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
with:
platforms: all

- name: Build wheels arm64
if: always() && matrix.os == 'ubuntu-24.04-arm'
run: pipx run cibuildwheel==2.22.0 --only ${{ matrix.only }}
env:
CIBW_SKIP: ${{ inputs.cibw_skip }}
CIBW_PRERELEASE_PYTHONS: ${{ inputs.cibw_prerelease_pythons }}
CIBW_MUSLLINUX_I686_IMAGE: ghcr.io/datadog/dd-trace-py/pypa_musllinux_1_2_i686:latest
CIBW_BEFORE_ALL: >
if [[ "$(uname -m)-$(uname -i)-$(uname -o | tr '[:upper:]' '[:lower:]')-$(ldd --version 2>&1 | head -n 1 | awk '{print $1}')" != "i686-unknown-linux-musl" ]];
then
curl -sSf https://sh.rustup.rs | sh -s -- -y;
fi
CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc
CIBW_BEFORE_ALL_MACOS: rustup target add aarch64-apple-darwin
CIBW_ENVIRONMENT_LINUX: PATH=$HOME/.cargo/bin:$PATH CMAKE_BUILD_PARALLEL_LEVEL=24 CMAKE_ARGS="-DNATIVE_TESTING=OFF"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
mkdir ./tempwheelhouse &&
unzip -l {wheel} | grep '\.so' &&
auditwheel repair -w ./tempwheelhouse {wheel} &&
for w in ./tempwheelhouse/*.whl; do
python scripts/zip_filter.py $w \*.c \*.cpp \*.cc \*.h \*.hpp \*.pyx \*.md
mv $w {dest_dir}
done &&
rm -rf ./tempwheelhouse
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
zip -d {wheel} \*.c \*.cpp \*.cc \*.h \*.hpp \*.pyx \*.md &&
MACOSX_DEPLOYMENT_TARGET=12.7 delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS:
choco install -y 7zip &&
7z d -r "{wheel}" *.c *.cpp *.cc *.h *.hpp *.pyx *.md &&
move "{wheel}" "{dest_dir}"
CIBW_TEST_COMMAND: "python {project}/tests/smoke_test.py"
# DEV: Uncomment to debug MacOS
# CIBW_BUILD_VERBOSITY_MACOS: 3

- name: Build wheels
if: always() && matrix.os != 'ubuntu-24.04-arm'
uses: pypa/cibuildwheel@faf86a6ed7efa889faf6996aa23820831055001a # v2.23.3
with:
only: ${{ matrix.only }}
env:
CIBW_SKIP: ${{ inputs.cibw_skip }}
CIBW_PRERELEASE_PYTHONS: ${{ inputs.cibw_prerelease_pythons }}
CIBW_MUSLLINUX_I686_IMAGE: ghcr.io/datadog/dd-trace-py/pypa_musllinux_1_2_i686:latest
CIBW_BEFORE_ALL: >
if [[ "$(uname -m)-$(uname -i)-$(uname -o | tr '[:upper:]' '[:lower:]')-$(ldd --version 2>&1 | head -n 1 | awk '{print $1}')" != "i686-unknown-linux-musl" ]];
then
yum install -y libatomic.i686
curl -sSf https://sh.rustup.rs | sh -s -- -y;

- name: Validate wheel RECORD files
shell: bash
run: |
for wheel in ./wheelhouse/*.whl; do
if [ -f "$wheel" ]; then
echo "Validating $(basename $wheel)..."
python scripts/validate_wheel.py "$wheel"
fi
CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc
CIBW_BEFORE_ALL_MACOS: rustup target add aarch64-apple-darwin
CIBW_ENVIRONMENT_LINUX: PATH=$HOME/.cargo/bin:$PATH CMAKE_BUILD_PARALLEL_LEVEL=24 CMAKE_ARGS="-DNATIVE_TESTING=OFF"
# SYSTEM_VERSION_COMPAT is a workaround for versioning issue, a.k.a.
# `platform.mac_ver()` reports incorrect MacOS version at 11.0
# See: https://stackoverflow.com/a/65402241
CIBW_ENVIRONMENT_MACOS: CMAKE_BUILD_PARALLEL_LEVEL=24 SYSTEM_VERSION_COMPAT=0 CMAKE_ARGS="-DNATIVE_TESTING=OFF"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
mkdir ./tempwheelhouse &&
unzip -l {wheel} | grep '\.so' &&
auditwheel repair -w ./tempwheelhouse {wheel} &&
for w in ./tempwheelhouse/*.whl; do
python scripts/zip_filter.py $w \*.c \*.cpp \*.cc \*.h \*.hpp \*.pyx \*.md
mv $w {dest_dir}
done &&
rm -rf ./tempwheelhouse
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
zip -d {wheel} \*.c \*.cpp \*.cc \*.h \*.hpp \*.pyx \*.md &&
MACOSX_DEPLOYMENT_TARGET=12.7 delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS:
choco install -y 7zip &&
7z d -r "{wheel}" *.c *.cpp *.cc *.h *.hpp *.pyx *.md &&
move "{wheel}" "{dest_dir}"
CIBW_TEST_COMMAND: "python {project}/tests/smoke_test.py"
# DEV: Uncomment to debug MacOS
# CIBW_BUILD_VERBOSITY_MACOS: 3
done

- if: runner.os != 'Windows'
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1094,19 +1094,19 @@ experiments:
- max_rss_usage < 34.00 MB
- name: telemetryaddmetric-100-count-metrics-100-times
thresholds:
- execution_time < 22.50 ms
- execution_time < 23.00 ms
- max_rss_usage < 34.00 MB
- name: telemetryaddmetric-100-distribution-metrics-100-times
thresholds:
- execution_time < 2.10 ms
- execution_time < 2.20 ms
- max_rss_usage < 34.00 MB
- name: telemetryaddmetric-100-gauge-metrics-100-times
thresholds:
- execution_time < 1.40 ms
- execution_time < 1.50 ms
- max_rss_usage < 34.00 MB
- name: telemetryaddmetric-100-rate-metrics-100-times
thresholds:
- execution_time < 2.40 ms
- execution_time < 2.50 ms
- max_rss_usage < 34.00 MB
- name: telemetryaddmetric-flush-1-metric
thresholds:
Expand All @@ -1118,7 +1118,7 @@ experiments:
- max_rss_usage < 34.00 MB
- name: telemetryaddmetric-flush-1000-metrics
thresholds:
- execution_time < 2.35 ms
- execution_time < 2.45 ms
- max_rss_usage < 34.50 MB

# tracer
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/benchmarks/steps/detect-baseline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ elif [[ "${UPSTREAM_BRANCH}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
BASELINE_BRANCH=$(echo "${UPSTREAM_BRANCH:1}" | cut -d. -f1-2)

# Check if a release branch exists or not
if git ls-remote --exit-code --heads origin "${BASELINE_BRANCH}" > /dev/null; then
if git ls-remote --exit-code --heads origin "refs/heads/${BASELINE_BRANCH}" > /dev/null; then
echo "Found remote branch origin/${BASELINE_BRANCH}"
else
echo "Remote branch origin/${BASELINE_BRANCH} not found. Falling back to main."
Expand Down
21 changes: 19 additions & 2 deletions .gitlab/download-wheels-from-gh-actions.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
#!/bin/bash
set -eo pipefail

get_run_id() {
RUN_ID=$(
gh run ls \
--repo DataDog/dd-trace-py \
--commit="$CI_COMMIT_SHA" \
$([ -z "$TRIGGERING_EVENT" ] && echo "" || echo "--event=$TRIGGERING_EVENT") \
--workflow=build_deploy.yml \
--json databaseId \
--jq "first (.[]) | .databaseId"
)
}

if [ -z "$CI_COMMIT_SHA" ]; then
echo "Error: CI_COMMIT_SHA was not provided"
exit 1
fi

RUN_ID=$(gh run ls --repo DataDog/dd-trace-py --commit=$CI_COMMIT_SHA --workflow=build_deploy.yml --json databaseId --jq "first (.[]) | .databaseId")
if [ -v "$CI_COMMIT_TAG" ]; then
TRIGGERING_EVENT="release"
fi

get_run_id

if [ -z "$RUN_ID" ]; then
echo "No RUN_ID found waiting for job to start"
# The job has not started yet. Give it time to start
Expand All @@ -19,7 +36,7 @@ if [ -z "$RUN_ID" ]; then
end_time=$((start_time + timeout))
# Loop for 10 minutes waiting for run to appear in github
while [ $(date +%s) -lt $end_time ]; do
RUN_ID=$(gh run ls --repo DataDog/dd-trace-py --commit=$CI_COMMIT_SHA --workflow=build_deploy.yml --json databaseId --jq "first (.[]) | .databaseId")
get_run_id
if [ -n "$RUN_ID" ]; then
break;
fi
Expand Down
Loading
Loading