Skip to content

Commit

Permalink
Merge branch 'main' into munir/fix-span-link-flags-dt
Browse files Browse the repository at this point in the history
  • Loading branch information
brettlangdon authored May 4, 2024
2 parents a047cf0 + 434f711 commit 654d0d1
Show file tree
Hide file tree
Showing 199 changed files with 10,077 additions and 2,636 deletions.
35 changes: 10 additions & 25 deletions .circleci/config.templ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mysql_image: &mysql_image mysql:5.7@sha256:03b6dcedf5a2754da00e119e2cc6094ed3c88
postgres_image: &postgres_image postgres:12-alpine@sha256:c6704f41eb84be53d5977cb821bf0e5e876064b55eafef1e260c2574de40ad9a
mongo_image: &mongo_image mongo:3.6@sha256:19c11a8f1064fd2bb713ef1270f79a742a184cd57d9bb922efdd2a8eca514af8
httpbin_image: &httpbin_image kennethreitz/httpbin@sha256:2c7abc4803080c22928265744410173b6fea3b898872c01c5fd0f0f9df4a59fb
vertica_image: &vertica_image sumitchawla/vertica:latest
vertica_image: &vertica_image vertica/vertica-ce:latest
rabbitmq_image: &rabbitmq_image rabbitmq:3.7-alpine
testagent_image: &testagent_image ghcr.io/datadog/dd-apm-test-agent/ddapm-test-agent:v1.16.0

Expand Down Expand Up @@ -142,12 +142,12 @@ commands:
- start_docker_services:
env: SNAPSHOT_CI=1
services: testagent << parameters.docker_services >>
- run: ulimit -c unlimited
- run:
environment:
DD_TRACE_AGENT_URL: << parameters.trace_agent_url >>
RIOT_RUN_RECOMPILE_REQS: "<< pipeline.parameters.riot_run_latest >>"
command: |
ulimit -c unlimited
./scripts/run-test-suite '<<parameters.pattern>>' <<pipeline.parameters.coverage>> 1
- run:
command: |
Expand Down Expand Up @@ -178,11 +178,11 @@ commands:
command: |
echo 'export DD_TRACE_AGENT_URL=<< parameters.trace_agent_url >>' >> "$BASH_ENV"
source "$BASH_ENV"
- run: ulimit -c unlimited
- run:
environment:
RIOT_RUN_RECOMPILE_REQS: "<< pipeline.parameters.riot_run_latest >>"
command: |
ulimit -c unlimited
./scripts/run-test-suite '<<parameters.pattern>>' <<pipeline.parameters.coverage>>
- run:
command: |
Expand Down Expand Up @@ -272,12 +272,12 @@ commands:
- start_docker_services:
env: SNAPSHOT_CI=1
services: testagent << parameters.docker_services >>
- run: ulimit -c unlimited
- run:
name: Run tests
environment:
DD_TRACE_AGENT_URL: << parameters.trace_agent_url >>
command: |
ulimit -c unlimited
./scripts/run-test-suite-hatch '<<parameters.env>>' 1
- run:
command: |
Expand Down Expand Up @@ -423,22 +423,22 @@ jobs:
- run: codecov
# Generate and save xml report
# DEV: "--ignore-errors" to skip over files that are missing
- run: coverage xml --ignore-errors
- run: coverage xml --ignore-errors || true
- store_artifacts:
path: coverage.xml
# Generate and save JSON report
# DEV: "--ignore-errors" to skip over files that are missing
- run: coverage json --ignore-errors
- run: coverage json --ignore-errors || true
- store_artifacts:
path: coverage.json
# Print ddtrace/ report to stdout
# DEV: "--ignore-errors" to skip over files that are missing
- run: coverage report --ignore-errors --omit=tests/
- run: coverage report --ignore-errors --omit=tests/ || true
# Print tests/ report to stdout
# DEV: "--ignore-errors" to skip over files that are missing
- run: coverage report --ignore-errors --omit=ddtrace/
- run: coverage report --ignore-errors --omit=ddtrace/ || true
# Print diff-cover report to stdout (compares against origin/1.x)
- run: diff-cover --compare-branch $(git rev-parse --abbrev-ref origin/HEAD) coverage.xml
- run: diff-cover --compare-branch $(git rev-parse --abbrev-ref origin/HEAD) coverage.xml || true


build_base_venvs:
Expand Down Expand Up @@ -643,11 +643,11 @@ jobs:
- setup_riot
- start_docker_services:
services: ddagent
- run: ulimit -c unlimited
- run:
environment:
RIOT_RUN_RECOMPILE_REQS: "<< pipeline.parameters.riot_run_latest >>"
command: |
ulimit -c unlimited
./scripts/run-test-suite 'integration-latest*' <<pipeline.parameters.coverage>> 1
- run:
command: |
Expand Down Expand Up @@ -1227,21 +1227,6 @@ jobs:
snapshot: true
docker_services: "httpbin_local"

vertica:
<<: *contrib_job
docker:
- image: *ddtrace_dev_image
- *testagent
- image: *vertica_image
environment:
- VP_TEST_USER=dbadmin
- VP_TEST_PASSWORD=abc123
- VP_TEST_DATABASE=docker
steps:
- run_test:
wait: vertica
pattern: 'vertica'

wsgi:
<<: *machine_executor
steps:
Expand Down
15 changes: 8 additions & 7 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* @DataDog/apm-core-python

# Framework Integrations
ddtrace/ext/ @DataDog/apm-core-python @DataDog/apm-framework-integrations
ddtrace/contrib/ @DataDog/apm-core-python @DataDog/apm-framework-integrations
ddtrace/internal/schema/ @DataDog/apm-core-python @DataDog/apm-framework-integrations
tests/contrib/ @DataDog/apm-core-python @DataDog/apm-framework-integrations
tests/internal/peer_service @DataDog/apm-core-python @DataDog/apm-framework-integrations
tests/internal/service_name @DataDog/apm-core-python @DataDog/apm-framework-integrations
tests/contrib/grpc @DataDog/apm-framework-integrations @DataDog/asm-python
ddtrace/ext/ @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/ @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/internal/schema/ @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/ @DataDog/apm-core-python @DataDog/apm-idm-python
tests/internal/peer_service @DataDog/apm-core-python @DataDog/apm-idm-python
tests/internal/service_name @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/grpc @DataDog/apm-idm-python @DataDog/asm-python

# Files which can be approved by anyone
# DEV: This helps not requiring apm-core-python to review new files added
Expand Down Expand Up @@ -63,6 +63,7 @@ ddtrace/appsec/ @DataDog/asm-python
ddtrace/settings/asm.py @DataDog/asm-python
ddtrace/contrib/subprocess/ @DataDog/asm-python
ddtrace/contrib/flask_login/ @DataDog/asm-python
ddtrace/internal/_exceptions.py @DataDog/asm-python
tests/appsec/ @DataDog/asm-python
tests/contrib/dbapi/test_dbapi_appsec.py @DataDog/asm-python
tests/contrib/subprocess @DataDog/asm-python
Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@ on:
# before merging/releasing
- build_deploy*
pull_request:
paths:
- ".github/workflows/build_deploy.yml"
- ".github/workflows/build_python_3.yml"
- "setup.py"
- "setup.cfg"
- "pyproject.toml"
- "**.c"
- "**.h"
- "**.cpp"
- "**.hpp"
- "**.pyx"
- "ddtrace/vendor/**"
release:
types:
- published
Expand Down
51 changes: 49 additions & 2 deletions .github/workflows/build_python_3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
include:
- os: ubuntu-latest
archs: x86_64 i686
- os: ubuntu-latest
- os: arm-4core-linux
archs: aarch64
- os: windows-latest
archs: AMD64 x86
Expand All @@ -34,17 +34,63 @@ jobs:
fetch-depth: 0

- uses: actions/setup-python@v4
if: matrix.os != 'arm-4core-linux'
name: Install Python
with:
python-version: '3.8'

- name: Install docker and pipx
if: matrix.os == 'arm-4core-linux'
# The ARM64 Ubuntu has less things installed by default
# We need docker, pip and venv for cibuildwheel
# acl allows us to use docker in the same session
run: |
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -a -G docker $USER
sudo apt install -y acl python3.10-venv python3-pip
sudo setfacl --modify user:runner:rw /var/run/docker.sock
python3 -m pip install pipx
- name: Set up QEMU
if: runner.os == 'Linux'
if: runner.os == 'Linux' && matrix.os != 'arm-4core-linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all

- name: Build wheels arm64
if: matrix.os == 'arm-4core-linux'
run: /home/runner/.local/bin/pipx run cibuildwheel==2.16.5 --platform linux
env:
# configure cibuildwheel to build native archs ('auto'), and some
# emulated ones
CIBW_ARCHS: ${{ matrix.archs }}
CIBW_BUILD: ${{ inputs.cibw_build }}
CIBW_SKIP: ${{ inputs.cibw_skip }}
CIBW_PRERELEASE_PYTHONS: ${{ inputs.cibw_prerelease_pythons }}
CMAKE_BUILD_PARALLEL_LEVEL: 12
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
mkdir ./tempwheelhouse &&
unzip -l {wheel} | grep '\.so' &&
auditwheel repair -w ./tempwheelhouse {wheel} &&
(yum install -y zip || apk add zip) &&
for w in ./tempwheelhouse/*.whl; do
zip -d $w \*.c \*.cpp \*.cc \*.h \*.hpp \*.pyx
mv $w {dest_dir}
done &&
rm -rf ./tempwheelhouse
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
zip -d {wheel} \*.c \*.cpp \*.cc \*.h \*.hpp \*.pyx &&
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 &&
move "{wheel}" "{dest_dir}"
# DEV: Uncomment to debug MacOS
# CIBW_BUILD_VERBOSITY_MACOS: 3

- name: Build wheels
if: matrix.os != 'arm-4core-linux'
uses: pypa/[email protected]
env:
# configure cibuildwheel to build native archs ('auto'), and some
Expand Down Expand Up @@ -73,6 +119,7 @@ jobs:
move "{wheel}" "{dest_dir}"
# DEV: Uncomment to debug MacOS
# CIBW_BUILD_VERBOSITY_MACOS: 3

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
1 change: 1 addition & 0 deletions .github/workflows/test_frameworks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ jobs:
expl_coverage: 1
runs-on: ubuntu-latest
needs: needs-run
timeout-minutes: 15
name: Django 3.1 (with ${{ matrix.suffix }})
env:
DD_PROFILING_ENABLED: true
Expand Down
4 changes: 4 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ stages:
- deploy
- benchmarks
- benchmarks-pr-comment
- macrobenchmarks

include:
- remote: https://gitlab-templates.ddbuild.io/apm/packaging.yml
- local: ".gitlab/benchmarks.yml"
- local: ".gitlab/macrobenchmarks.yml"

variables:
DOWNSTREAM_BRANCH:
Expand All @@ -30,6 +32,7 @@ package:
when: on_success
script:
- ../.gitlab/build-deb-rpm.sh
- find . -iregex '.*\.\(deb\|rpm\)' -printf '%f\0' | xargs -0 dd-pkg lint

package-arm:
extends: .package-arm
Expand All @@ -40,6 +43,7 @@ package-arm:
when: on_success
script:
- ../.gitlab/build-deb-rpm.sh
- find . -iregex '.*\.\(deb\|rpm\)' -printf '%f\0' | xargs -0 dd-pkg lint

.release-package:
stage: deploy
Expand Down
4 changes: 2 additions & 2 deletions .gitlab/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ variables:
- git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/"
- git clone --branch dd-trace-py https://github.com/DataDog/benchmarking-platform /platform && cd /platform
- ./steps/capture-hardware-software-info.sh
- ./steps/run-benchmarks.sh
- '([ $SCENARIO = "flask_simple" ] && BP_SCENARIO=$SCENARIO /benchmarking-platform-tools/bp-runner/bp-runner "$REPORTS_DIR/../.gitlab/benchmarks/bp-runner.yml" --debug -t) || ([ $SCENARIO != "flask_simple" ] && ./steps/run-benchmarks.sh)'
- ./steps/analyze-results.sh
- "./steps/upload-results-to-s3.sh || :"
artifacts:
Expand Down Expand Up @@ -87,7 +87,7 @@ benchmark-flask-sqli:
extends: .benchmarks
variables:
SCENARIO: "flask_sqli"

benchmark-core-api:
extends: .benchmarks
variables:
Expand Down
13 changes: 13 additions & 0 deletions .gitlab/benchmarks/bp-runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
experiments:
- name: run-microbenchmarks
setup:
- name: datadog-agent
run: datadog_agent
cpus: 24-25
config_sh: ./steps/update-dd-agent-config.sh

steps:
- name: benchmarks
cpus: 26-47
run: shell
script: export SCENARIO=$BP_SCENARIO && ./steps/run-benchmarks.sh
86 changes: 86 additions & 0 deletions .gitlab/macrobenchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
variables:
BASE_CI_IMAGE: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/benchmarking-platform:dd-trace-py-macrobenchmarks

.macrobenchmarks:
stage: macrobenchmarks
needs: []
tags: ["runner:apm-k8s-same-cpu"]
timeout: 1h
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: always
- when: manual
## Next step, enable:
# - if: $CI_COMMIT_REF_NAME == "main"
# when: always
# If you have a problem with Gitlab cache, see Troubleshooting section in Benchmarking Platform docs
image: $BENCHMARKS_CI_IMAGE
script: |
git clone --branch python/macrobenchmarks https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform && cd platform
if [ "$BP_PYTHON_SCENARIO_DIR" == "flask-realworld" ]; then
bp-runner bp-runner.flask-realworld.yml --debug
else
bp-runner bp-runner.simple.yml --debug
fi
artifacts:
name: "artifacts"
when: always
paths:
- platform/artifacts/
expire_in: 3 months
variables:
# Benchmark's env variables. Modify to tweak benchmark parameters.
DD_TRACE_DEBUG: "false"
DD_RUNTIME_METRICS_ENABLED: "true"
DD_REMOTE_CONFIGURATION_ENABLED: "false"
DD_INSTRUMENTATION_TELEMETRY_ENABLED: "false"

K6_OPTIONS_NORMAL_OPERATION_RATE: 40
K6_OPTIONS_NORMAL_OPERATION_DURATION: 5m
K6_OPTIONS_NORMAL_OPERATION_GRACEFUL_STOP: 1m
K6_OPTIONS_NORMAL_OPERATION_PRE_ALLOCATED_VUS: 4
K6_OPTIONS_NORMAL_OPERATION_MAX_VUS: 4

K6_OPTIONS_HIGH_LOAD_RATE: 500
K6_OPTIONS_HIGH_LOAD_DURATION: 1m
K6_OPTIONS_HIGH_LOAD_GRACEFUL_STOP: 30s
K6_OPTIONS_HIGH_LOAD_PRE_ALLOCATED_VUS: 4
K6_OPTIONS_HIGH_LOAD_MAX_VUS: 4

# Gitlab and BP specific env vars. Do not modify.
FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: "true"

# Workaround: Currently we're not running the benchmarks on every PR, but GitHub still shows them as pending.
# By marking the benchmarks as allow_failure, this should go away. (This workaround should be removed once the
# benchmarks get changed to run on every PR)
allow_failure: true

macrobenchmarks:
extends: .macrobenchmarks
parallel:
matrix:
- DD_BENCHMARKS_CONFIGURATION: baseline
BP_PYTHON_SCENARIO_DIR: flask-realworld
DDTRACE_INSTALL_VERSION: "git+https://github.com/Datadog/dd-trace-py@${CI_COMMIT_SHA}"

- DD_BENCHMARKS_CONFIGURATION: only-tracing
BP_PYTHON_SCENARIO_DIR: flask-realworld
DDTRACE_INSTALL_VERSION: "git+https://github.com/Datadog/dd-trace-py@${CI_COMMIT_SHA}"

- DD_BENCHMARKS_CONFIGURATION: only-tracing
BP_PYTHON_SCENARIO_DIR: flask-realworld
DDTRACE_INSTALL_VERSION: "git+https://github.com/Datadog/dd-trace-py@${CI_COMMIT_SHA}"
DD_REMOTE_CONFIGURATION_ENABLED: "false"
DD_INSTRUMENTATION_TELEMETRY_ENABLED: "true"

- DD_BENCHMARKS_CONFIGURATION: only-tracing
BP_PYTHON_SCENARIO_DIR: flask-realworld
DDTRACE_INSTALL_VERSION: "git+https://github.com/Datadog/dd-trace-py@${CI_COMMIT_SHA}"
DD_REMOTE_CONFIGURATION_ENABLED: "false"
DD_INSTRUMENTATION_TELEMETRY_ENABLED: "false"

- DD_BENCHMARKS_CONFIGURATION: only-tracing
BP_PYTHON_SCENARIO_DIR: flask-realworld
DDTRACE_INSTALL_VERSION: "git+https://github.com/Datadog/dd-trace-py@${CI_COMMIT_SHA}"
DD_REMOTE_CONFIGURATION_ENABLED: "true"
DD_INSTRUMENTATION_TELEMETRY_ENABLED: "true"
Loading

0 comments on commit 654d0d1

Please sign in to comment.