From 9c4dd35594cc909b8411377801c536d1e28f162b Mon Sep 17 00:00:00 2001 From: Federico Mon Date: Thu, 6 Nov 2025 14:22:51 +0100 Subject: [PATCH 1/5] pytest benchmark plugin removal ITR:NoSkip --- .../internal/pytest_benchmark/__init__.py | 3 - .../internal/pytest_benchmark/_plugin.py | 28 ------- .../internal/pytest_benchmark/constants.py | 79 ------------------- .../internal/pytest_benchmark/plugin.py | 14 ---- 4 files changed, 124 deletions(-) delete mode 100644 ddtrace/contrib/internal/pytest_benchmark/__init__.py delete mode 100644 ddtrace/contrib/internal/pytest_benchmark/_plugin.py delete mode 100644 ddtrace/contrib/internal/pytest_benchmark/constants.py delete mode 100644 ddtrace/contrib/internal/pytest_benchmark/plugin.py diff --git a/ddtrace/contrib/internal/pytest_benchmark/__init__.py b/ddtrace/contrib/internal/pytest_benchmark/__init__.py deleted file mode 100644 index 6f7df090942..00000000000 --- a/ddtrace/contrib/internal/pytest_benchmark/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -""" -The pytest-benchmark integration traces executions of pytest benchmarks. -""" diff --git a/ddtrace/contrib/internal/pytest_benchmark/_plugin.py b/ddtrace/contrib/internal/pytest_benchmark/_plugin.py deleted file mode 100644 index 2b08969ac21..00000000000 --- a/ddtrace/contrib/internal/pytest_benchmark/_plugin.py +++ /dev/null @@ -1,28 +0,0 @@ -import pytest - -from ddtrace.contrib.internal.pytest._utils import _extract_span -from ddtrace.contrib.internal.pytest_benchmark.constants import BENCHMARK_INFO -from ddtrace.contrib.internal.pytest_benchmark.constants import PLUGIN_METRICS -from ddtrace.contrib.internal.pytest_benchmark.constants import PLUGIN_OUTLIERS -from ddtrace.ext.test import TEST_TYPE - - -class _PytestBenchmarkPlugin: - @pytest.hookimpl() - def pytest_runtest_makereport(self, item, call): - fixture = hasattr(item, "funcargs") and item.funcargs.get("benchmark") - if fixture and fixture.stats: - stat_object = fixture.stats.stats - span = _extract_span(item) - - if span is None: - return - - span._set_tag_str(TEST_TYPE, "benchmark") - span._set_tag_str(BENCHMARK_INFO, "Time") - for span_path, tag in PLUGIN_METRICS.items(): - if hasattr(stat_object, tag): - if tag == PLUGIN_OUTLIERS: - span._set_tag_str(span_path, getattr(stat_object, tag)) - continue - span.set_tag(span_path, getattr(stat_object, tag)) diff --git a/ddtrace/contrib/internal/pytest_benchmark/constants.py b/ddtrace/contrib/internal/pytest_benchmark/constants.py deleted file mode 100644 index b4c4f7f5b27..00000000000 --- a/ddtrace/contrib/internal/pytest_benchmark/constants.py +++ /dev/null @@ -1,79 +0,0 @@ -BENCHMARK_INFO = "benchmark.duration.info" -BENCHMARK_MEAN = "benchmark.duration.mean" -BENCHMARK_RUN = "benchmark.duration.runs" - -STATISTICS_HD15IQR = "benchmark.duration.statistics.hd15iqr" -STATISTICS_IQR = "benchmark.duration.statistics.iqr" -STATISTICS_IQR_OUTLIERS = "benchmark.duration.statistics.iqr_outliers" -STATISTICS_LD15IQR = "benchmark.duration.statistics.ld15iqr" -STATISTICS_MAX = "benchmark.duration.statistics.max" -STATISTICS_MEAN = "benchmark.duration.statistics.mean" -STATISTICS_MEDIAN = "benchmark.duration.statistics.median" -STATISTICS_MIN = "benchmark.duration.statistics.min" -STATISTICS_N = "benchmark.duration.statistics.n" -STATISTICS_OPS = "benchmark.duration.statistics.ops" -STATISTICS_OUTLIERS = "benchmark.duration.statistics.outliers" -STATISTICS_Q1 = "benchmark.duration.statistics.q1" -STATISTICS_Q3 = "benchmark.duration.statistics.q3" -STATISTICS_STDDEV = "benchmark.duration.statistics.std_dev" -STATISTICS_STDDEV_OUTLIERS = "benchmark.duration.statistics.std_dev_outliers" -STATISTICS_TOTAL = "benchmark.duration.statistics.total" - -PLUGIN_HD15IQR = "hd15iqr" -PLUGIN_IQR = "iqr" -PLUGIN_IQR_OUTLIERS = "iqr_outliers" -PLUGIN_LD15IQR = "ld15iqr" -PLUGIN_MAX = "max" -PLUGIN_MEAN = "mean" -PLUGIN_MEDIAN = "median" -PLUGIN_MIN = "min" -PLUGIN_OPS = "ops" -PLUGIN_OUTLIERS = "outliers" -PLUGIN_Q1 = "q1" -PLUGIN_Q3 = "q3" -PLUGIN_ROUNDS = "rounds" -PLUGIN_STDDEV = "stddev" -PLUGIN_STDDEV_OUTLIERS = "stddev_outliers" -PLUGIN_TOTAL = "total" - -PLUGIN_METRICS = { - BENCHMARK_MEAN: PLUGIN_MEAN, - BENCHMARK_RUN: PLUGIN_ROUNDS, - STATISTICS_HD15IQR: PLUGIN_HD15IQR, - STATISTICS_IQR: PLUGIN_IQR, - STATISTICS_IQR_OUTLIERS: PLUGIN_IQR_OUTLIERS, - STATISTICS_LD15IQR: PLUGIN_LD15IQR, - STATISTICS_MAX: PLUGIN_MAX, - STATISTICS_MEAN: PLUGIN_MEAN, - STATISTICS_MEDIAN: PLUGIN_MEDIAN, - STATISTICS_MIN: PLUGIN_MIN, - STATISTICS_OPS: PLUGIN_OPS, - STATISTICS_OUTLIERS: PLUGIN_OUTLIERS, - STATISTICS_Q1: PLUGIN_Q1, - STATISTICS_Q3: PLUGIN_Q3, - STATISTICS_N: PLUGIN_ROUNDS, - STATISTICS_STDDEV: PLUGIN_STDDEV, - STATISTICS_STDDEV_OUTLIERS: PLUGIN_STDDEV_OUTLIERS, - STATISTICS_TOTAL: PLUGIN_TOTAL, -} - -PLUGIN_METRICS_V2 = { - "duration_mean": PLUGIN_MEAN, - "duration_runs": PLUGIN_ROUNDS, - "statistics_hd15iqr": PLUGIN_HD15IQR, - "statistics_iqr": PLUGIN_IQR, - "statistics_iqr_outliers": PLUGIN_IQR_OUTLIERS, - "statistics_ld15iqr": PLUGIN_LD15IQR, - "statistics_max": PLUGIN_MAX, - "statistics_mean": PLUGIN_MEAN, - "statistics_median": PLUGIN_MEDIAN, - "statistics_min": PLUGIN_MIN, - "statistics_n": PLUGIN_ROUNDS, - "statistics_ops": PLUGIN_OPS, - "statistics_outliers": PLUGIN_OUTLIERS, - "statistics_q1": PLUGIN_Q1, - "statistics_q3": PLUGIN_Q3, - "statistics_std_dev": PLUGIN_STDDEV, - "statistics_std_dev_outliers": PLUGIN_STDDEV_OUTLIERS, - "statistics_total": PLUGIN_TOTAL, -} diff --git a/ddtrace/contrib/internal/pytest_benchmark/plugin.py b/ddtrace/contrib/internal/pytest_benchmark/plugin.py deleted file mode 100644 index 7144bbd8a6f..00000000000 --- a/ddtrace/contrib/internal/pytest_benchmark/plugin.py +++ /dev/null @@ -1,14 +0,0 @@ -from ddtrace import DDTraceDeprecationWarning -from ddtrace.contrib.internal.pytest.plugin import is_enabled as is_ddtrace_enabled -from ddtrace.vendor.debtcollector import deprecate - - -def pytest_configure(config): - if config.pluginmanager.hasplugin("benchmark") and config.pluginmanager.hasplugin("ddtrace"): - if is_ddtrace_enabled(config): - deprecate( - "this version of the ddtrace.pytest_benchmark plugin is deprecated", - message="it will be integrated with the main pytest ddtrace plugin", - removal_version="3.0.0", - category=DDTraceDeprecationWarning, - ) From 809fa8caa4e187c94da026351fdef560570fde63 Mon Sep 17 00:00:00 2001 From: Federico Mon Date: Thu, 6 Nov 2025 14:26:40 +0100 Subject: [PATCH 2/5] remove from pyproject.toml --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a3c77ff75ea..79406685b07 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,7 +65,6 @@ ddcontextvars_context = "ddtrace.internal.opentelemetry.context:DDRuntimeContext [project.entry-points.pytest11] ddtrace = "ddtrace.contrib.internal.pytest.plugin" "ddtrace.pytest_bdd" = "ddtrace.contrib.internal.pytest_bdd.plugin" -"ddtrace.pytest_benchmark" = "ddtrace.contrib.internal.pytest_benchmark.plugin" [project.entry-points.'ddtrace.products'] "apm-tracing-rc" = "ddtrace.internal.remoteconfig.products.apm_tracing" From 265948515655591e8bb71b46d09d299dca3370ba Mon Sep 17 00:00:00 2001 From: Federico Mon Date: Thu, 6 Nov 2025 15:03:43 +0100 Subject: [PATCH 3/5] suitespec change --- tests/ci_visibility/suitespec.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/ci_visibility/suitespec.yml b/tests/ci_visibility/suitespec.yml index 99b565bcd10..60f87fb517d 100644 --- a/tests/ci_visibility/suitespec.yml +++ b/tests/ci_visibility/suitespec.yml @@ -57,7 +57,6 @@ suites: - '@codeowners' - '@freezegun' - tests/contrib/pytest/* - - tests/contrib/pytest_benchmark/* - tests/contrib/pytest_bdd/* - tests/contrib/pytest_flaky/* - tests/snapshots/tests.contrib.pytest.* From 554b1feca60408e6949407e19c03ae6f29f480b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20De=20Ara=C3=BAjo?= Date: Thu, 6 Nov 2025 14:19:33 +0000 Subject: [PATCH 4/5] move benchmark constants --- .../internal/pytest/_benchmark_utils.py | 2 +- .../internal/pytest/benchmark_constants.py | 79 +++++++++++++++++++ ddtrace/internal/ci_visibility/api/_test.py | 2 +- .../test_pytest_benchmark.py | 38 ++++----- tests/contrib/pytest_benchmark/__init__.py | 0 5 files changed, 100 insertions(+), 21 deletions(-) create mode 100644 ddtrace/contrib/internal/pytest/benchmark_constants.py rename tests/contrib/{pytest_benchmark => pytest}/test_pytest_benchmark.py (82%) delete mode 100644 tests/contrib/pytest_benchmark/__init__.py diff --git a/ddtrace/contrib/internal/pytest/_benchmark_utils.py b/ddtrace/contrib/internal/pytest/_benchmark_utils.py index 70a79c60700..64d8065b857 100644 --- a/ddtrace/contrib/internal/pytest/_benchmark_utils.py +++ b/ddtrace/contrib/internal/pytest/_benchmark_utils.py @@ -1,7 +1,7 @@ import pytest from ddtrace.contrib.internal.pytest._utils import _get_test_id_from_item -from ddtrace.contrib.internal.pytest_benchmark.constants import PLUGIN_METRICS_V2 +from ddtrace.contrib.internal.pytest.benchmark_constants import PLUGIN_METRICS_V2 from ddtrace.internal.logger import get_logger from ddtrace.internal.test_visibility._benchmark_mixin import BenchmarkDurationData from ddtrace.internal.test_visibility.api import InternalTest diff --git a/ddtrace/contrib/internal/pytest/benchmark_constants.py b/ddtrace/contrib/internal/pytest/benchmark_constants.py new file mode 100644 index 00000000000..b4c4f7f5b27 --- /dev/null +++ b/ddtrace/contrib/internal/pytest/benchmark_constants.py @@ -0,0 +1,79 @@ +BENCHMARK_INFO = "benchmark.duration.info" +BENCHMARK_MEAN = "benchmark.duration.mean" +BENCHMARK_RUN = "benchmark.duration.runs" + +STATISTICS_HD15IQR = "benchmark.duration.statistics.hd15iqr" +STATISTICS_IQR = "benchmark.duration.statistics.iqr" +STATISTICS_IQR_OUTLIERS = "benchmark.duration.statistics.iqr_outliers" +STATISTICS_LD15IQR = "benchmark.duration.statistics.ld15iqr" +STATISTICS_MAX = "benchmark.duration.statistics.max" +STATISTICS_MEAN = "benchmark.duration.statistics.mean" +STATISTICS_MEDIAN = "benchmark.duration.statistics.median" +STATISTICS_MIN = "benchmark.duration.statistics.min" +STATISTICS_N = "benchmark.duration.statistics.n" +STATISTICS_OPS = "benchmark.duration.statistics.ops" +STATISTICS_OUTLIERS = "benchmark.duration.statistics.outliers" +STATISTICS_Q1 = "benchmark.duration.statistics.q1" +STATISTICS_Q3 = "benchmark.duration.statistics.q3" +STATISTICS_STDDEV = "benchmark.duration.statistics.std_dev" +STATISTICS_STDDEV_OUTLIERS = "benchmark.duration.statistics.std_dev_outliers" +STATISTICS_TOTAL = "benchmark.duration.statistics.total" + +PLUGIN_HD15IQR = "hd15iqr" +PLUGIN_IQR = "iqr" +PLUGIN_IQR_OUTLIERS = "iqr_outliers" +PLUGIN_LD15IQR = "ld15iqr" +PLUGIN_MAX = "max" +PLUGIN_MEAN = "mean" +PLUGIN_MEDIAN = "median" +PLUGIN_MIN = "min" +PLUGIN_OPS = "ops" +PLUGIN_OUTLIERS = "outliers" +PLUGIN_Q1 = "q1" +PLUGIN_Q3 = "q3" +PLUGIN_ROUNDS = "rounds" +PLUGIN_STDDEV = "stddev" +PLUGIN_STDDEV_OUTLIERS = "stddev_outliers" +PLUGIN_TOTAL = "total" + +PLUGIN_METRICS = { + BENCHMARK_MEAN: PLUGIN_MEAN, + BENCHMARK_RUN: PLUGIN_ROUNDS, + STATISTICS_HD15IQR: PLUGIN_HD15IQR, + STATISTICS_IQR: PLUGIN_IQR, + STATISTICS_IQR_OUTLIERS: PLUGIN_IQR_OUTLIERS, + STATISTICS_LD15IQR: PLUGIN_LD15IQR, + STATISTICS_MAX: PLUGIN_MAX, + STATISTICS_MEAN: PLUGIN_MEAN, + STATISTICS_MEDIAN: PLUGIN_MEDIAN, + STATISTICS_MIN: PLUGIN_MIN, + STATISTICS_OPS: PLUGIN_OPS, + STATISTICS_OUTLIERS: PLUGIN_OUTLIERS, + STATISTICS_Q1: PLUGIN_Q1, + STATISTICS_Q3: PLUGIN_Q3, + STATISTICS_N: PLUGIN_ROUNDS, + STATISTICS_STDDEV: PLUGIN_STDDEV, + STATISTICS_STDDEV_OUTLIERS: PLUGIN_STDDEV_OUTLIERS, + STATISTICS_TOTAL: PLUGIN_TOTAL, +} + +PLUGIN_METRICS_V2 = { + "duration_mean": PLUGIN_MEAN, + "duration_runs": PLUGIN_ROUNDS, + "statistics_hd15iqr": PLUGIN_HD15IQR, + "statistics_iqr": PLUGIN_IQR, + "statistics_iqr_outliers": PLUGIN_IQR_OUTLIERS, + "statistics_ld15iqr": PLUGIN_LD15IQR, + "statistics_max": PLUGIN_MAX, + "statistics_mean": PLUGIN_MEAN, + "statistics_median": PLUGIN_MEDIAN, + "statistics_min": PLUGIN_MIN, + "statistics_n": PLUGIN_ROUNDS, + "statistics_ops": PLUGIN_OPS, + "statistics_outliers": PLUGIN_OUTLIERS, + "statistics_q1": PLUGIN_Q1, + "statistics_q3": PLUGIN_Q3, + "statistics_std_dev": PLUGIN_STDDEV, + "statistics_std_dev_outliers": PLUGIN_STDDEV_OUTLIERS, + "statistics_total": PLUGIN_TOTAL, +} diff --git a/ddtrace/internal/ci_visibility/api/_test.py b/ddtrace/internal/ci_visibility/api/_test.py index 6ab5dd86c49..1366301a91c 100644 --- a/ddtrace/internal/ci_visibility/api/_test.py +++ b/ddtrace/internal/ci_visibility/api/_test.py @@ -9,7 +9,7 @@ import ddtrace from ddtrace._trace.context import Context -from ddtrace.contrib.internal.pytest_benchmark.constants import BENCHMARK_INFO +from ddtrace.contrib.internal.pytest.benchmark_constants import BENCHMARK_INFO from ddtrace.ext import SpanTypes from ddtrace.ext import test from ddtrace.ext.test_visibility import ITR_SKIPPING_LEVEL diff --git a/tests/contrib/pytest_benchmark/test_pytest_benchmark.py b/tests/contrib/pytest/test_pytest_benchmark.py similarity index 82% rename from tests/contrib/pytest_benchmark/test_pytest_benchmark.py rename to tests/contrib/pytest/test_pytest_benchmark.py index 233a389855c..2cee9b7b438 100644 --- a/tests/contrib/pytest_benchmark/test_pytest_benchmark.py +++ b/tests/contrib/pytest/test_pytest_benchmark.py @@ -1,24 +1,24 @@ import os -from ddtrace.contrib.internal.pytest_benchmark.constants import BENCHMARK_INFO -from ddtrace.contrib.internal.pytest_benchmark.constants import BENCHMARK_MEAN -from ddtrace.contrib.internal.pytest_benchmark.constants import BENCHMARK_RUN -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_HD15IQR -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_IQR -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_IQR_OUTLIERS -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_LD15IQR -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_MAX -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_MEAN -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_MEDIAN -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_MIN -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_N -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_OPS -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_OUTLIERS -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_Q1 -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_Q3 -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_STDDEV -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_STDDEV_OUTLIERS -from ddtrace.contrib.internal.pytest_benchmark.constants import STATISTICS_TOTAL +from ddtrace.contrib.internal.pytest.benchmark_constants import BENCHMARK_INFO +from ddtrace.contrib.internal.pytest.benchmark_constants import BENCHMARK_MEAN +from ddtrace.contrib.internal.pytest.benchmark_constants import BENCHMARK_RUN +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_HD15IQR +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_IQR +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_IQR_OUTLIERS +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_LD15IQR +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_MAX +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_MEAN +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_MEDIAN +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_MIN +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_N +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_OPS +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_OUTLIERS +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_Q1 +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_Q3 +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_STDDEV +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_STDDEV_OUTLIERS +from ddtrace.contrib.internal.pytest.benchmark_constants import STATISTICS_TOTAL from ddtrace.ext.test import TEST_TYPE from tests.contrib.pytest.test_pytest import PytestTestCaseBase diff --git a/tests/contrib/pytest_benchmark/__init__.py b/tests/contrib/pytest_benchmark/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 From fab4418328e2dc4259432d4beff84c0d37ef5a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20De=20Ara=C3=BAjo?= Date: Thu, 6 Nov 2025 14:24:37 +0000 Subject: [PATCH 5/5] remove from integration registry --- ddtrace/contrib/integration_registry/mappings.py | 1 - ddtrace/contrib/integration_registry/registry.yaml | 6 ------ 2 files changed, 7 deletions(-) diff --git a/ddtrace/contrib/integration_registry/mappings.py b/ddtrace/contrib/integration_registry/mappings.py index f079c5f25b8..d8e77b56e9f 100644 --- a/ddtrace/contrib/integration_registry/mappings.py +++ b/ddtrace/contrib/integration_registry/mappings.py @@ -4,7 +4,6 @@ EXCLUDED_FROM_TESTING = { "coverage", - "pytest_benchmark", "asgi", "wsgi", "boto", diff --git a/ddtrace/contrib/integration_registry/registry.yaml b/ddtrace/contrib/integration_registry/registry.yaml index a2b9c616b2a..fc1d8ab88f9 100644 --- a/ddtrace/contrib/integration_registry/registry.yaml +++ b/ddtrace/contrib/integration_registry/registry.yaml @@ -783,12 +783,6 @@ integrations: min: 4.1.0 max: 6.0.1 -- integration_name: pytest_benchmark - is_external_package: true - is_tested: false - dependency_names: - - pytest_benchmark - - integration_name: ray is_external_package: true is_tested: false