From abd16141d10d7f225ada247c481592e4701e5d54 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Wed, 22 Jan 2025 10:43:43 -0500 Subject: [PATCH 1/7] ci: check for benchmark regressions on PRs --- .gitlab/benchmarks.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.gitlab/benchmarks.yml b/.gitlab/benchmarks.yml index 9d56afcdf09..c3b74aa66ee 100644 --- a/.gitlab/benchmarks.yml +++ b/.gitlab/benchmarks.yml @@ -78,6 +78,20 @@ benchmarks-pr-comment: UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA # The commit revision the project is built for. KUBERNETES_SERVICE_ACCOUNT_OVERWRITE: dd-trace-py +check-big-regressions: + stage: benchmarks + needs: [ microbenchmarks, benchmark-serverless ] + when: on_success + tags: ["arch:amd64"] + image: $MICROBENCHMARKS_CI_IMAGE + script: + - 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 + - bp-runner bp-runner.fail-on-regression.yml --debug + variables: + # Gitlab and BP specific env vars. Do not modify. + KUBERNETES_SERVICE_ACCOUNT_OVERWRITE: dd-trace-py + benchmark-serverless: stage: benchmarks image: $SLS_CI_IMAGE From 57a23b8b36b3abab4deccba0a4f57494b17890a3 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Wed, 22 Jan 2025 13:11:30 -0500 Subject: [PATCH 2/7] introduce regression --- ddtrace/propagation/http.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ddtrace/propagation/http.py b/ddtrace/propagation/http.py index fdaf97410ad..1c031fc6e73 100644 --- a/ddtrace/propagation/http.py +++ b/ddtrace/propagation/http.py @@ -1,6 +1,7 @@ import itertools import re import sys +import time from typing import Any # noqa:F401 from typing import Dict # noqa:F401 from typing import FrozenSet # noqa:F401 @@ -1126,6 +1127,7 @@ def my_controller(url, headers): :param dict headers: HTTP headers to extract tracing attributes. :return: New `Context` with propagated attributes. """ + time.sleep(1) context = Context() if not headers or not config._propagation_style_extract: return context From dcf2d3b28de50110e7812ca61eb2cf856a0e714a Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Thu, 23 Jan 2025 08:14:08 -0500 Subject: [PATCH 3/7] don't allow failures --- .gitlab/benchmarks.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab/benchmarks.yml b/.gitlab/benchmarks.yml index c3b74aa66ee..9cf103426cf 100644 --- a/.gitlab/benchmarks.yml +++ b/.gitlab/benchmarks.yml @@ -25,7 +25,6 @@ variables: paths: - reports/ expire_in: 3 months - allow_failure: true # Allow failure, so partial results are uploaded variables: UPSTREAM_PROJECT_ID: $CI_PROJECT_ID # The ID of the current project. This ID is unique across all projects on the GitLab instance. UPSTREAM_PROJECT_NAME: $CI_PROJECT_NAME # "dd-trace-py" From f5b1d8cf6efdab9ae8a078144ffa8b10046f9ff3 Mon Sep 17 00:00:00 2001 From: Dmytro Yurchenko Date: Thu, 23 Jan 2025 08:18:19 -0500 Subject: [PATCH 4/7] chore: Configure ARTIFACTS_DIR to use for regression check --- .gitlab/benchmarks.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab/benchmarks.yml b/.gitlab/benchmarks.yml index 9cf103426cf..9d351677374 100644 --- a/.gitlab/benchmarks.yml +++ b/.gitlab/benchmarks.yml @@ -84,6 +84,7 @@ check-big-regressions: tags: ["arch:amd64"] image: $MICROBENCHMARKS_CI_IMAGE script: + - export ARTIFACTS_DIR="$(pwd)/reports/" - 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 - bp-runner bp-runner.fail-on-regression.yml --debug From f703accada2f3a6eca1d1c771ebabc445f11f171 Mon Sep 17 00:00:00 2001 From: Dmytro Yurchenko Date: Thu, 23 Jan 2025 15:24:19 +0100 Subject: [PATCH 5/7] chore: Run check-big-regressions even when some CI jobs failed --- .gitlab/benchmarks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/benchmarks.yml b/.gitlab/benchmarks.yml index 9d351677374..6c7b48aea3a 100644 --- a/.gitlab/benchmarks.yml +++ b/.gitlab/benchmarks.yml @@ -80,7 +80,7 @@ benchmarks-pr-comment: check-big-regressions: stage: benchmarks needs: [ microbenchmarks, benchmark-serverless ] - when: on_success + when: always tags: ["arch:amd64"] image: $MICROBENCHMARKS_CI_IMAGE script: From 9800e8edd6e77a970f3cb10ed1a86ac7db75af6d Mon Sep 17 00:00:00 2001 From: Dmytro Yurchenko Date: Thu, 23 Jan 2025 15:27:41 +0100 Subject: [PATCH 6/7] chore: Reduce regression size --- ddtrace/propagation/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ddtrace/propagation/http.py b/ddtrace/propagation/http.py index 1c031fc6e73..d41a79d6458 100644 --- a/ddtrace/propagation/http.py +++ b/ddtrace/propagation/http.py @@ -1127,7 +1127,7 @@ def my_controller(url, headers): :param dict headers: HTTP headers to extract tracing attributes. :return: New `Context` with propagated attributes. """ - time.sleep(1) + time.sleep(0.2) context = Context() if not headers or not config._propagation_style_extract: return context From fdfee2c8c746eed7304dd8f4c6cd41390947a048 Mon Sep 17 00:00:00 2001 From: Brett Langdon Date: Thu, 23 Jan 2025 10:09:55 -0500 Subject: [PATCH 7/7] Apply suggestions from code review --- ddtrace/propagation/http.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/ddtrace/propagation/http.py b/ddtrace/propagation/http.py index d41a79d6458..fdaf97410ad 100644 --- a/ddtrace/propagation/http.py +++ b/ddtrace/propagation/http.py @@ -1,7 +1,6 @@ import itertools import re import sys -import time from typing import Any # noqa:F401 from typing import Dict # noqa:F401 from typing import FrozenSet # noqa:F401 @@ -1127,7 +1126,6 @@ def my_controller(url, headers): :param dict headers: HTTP headers to extract tracing attributes. :return: New `Context` with propagated attributes. """ - time.sleep(0.2) context = Context() if not headers or not config._propagation_style_extract: return context