From b10294042f4644f028d1c945d7b6c8f9892eee2b Mon Sep 17 00:00:00 2001 From: Charles de Beauchesne Date: Fri, 29 Nov 2024 18:41:55 +0100 Subject: [PATCH] Use a dedicated file to define profiling scenario (#3598) --- utils/_context/_scenarios/__init__.py | 19 ++----------------- utils/_context/_scenarios/profiling.py | 22 ++++++++++++++++++++++ utils/scripts/compute_impacted_scenario.py | 2 ++ 3 files changed, 26 insertions(+), 17 deletions(-) create mode 100644 utils/_context/_scenarios/profiling.py diff --git a/utils/_context/_scenarios/__init__.py b/utils/_context/_scenarios/__init__.py index a028451805..f6ab153f26 100644 --- a/utils/_context/_scenarios/__init__.py +++ b/utils/_context/_scenarios/__init__.py @@ -13,6 +13,7 @@ from .open_telemetry import OpenTelemetryScenario from .parametric import ParametricScenario from .performance import PerformanceScenario +from .profiling import ProfilingScenario from .test_the_test import TestTheTestScenario from .auto_injection import InstallerAutoInjectionScenario, InstallerAutoInjectionScenarioProfiling from .k8s_lib_injection import KubernetesScenario, WeblogInjectionScenario @@ -70,23 +71,7 @@ def all_endtoend_scenarios(test_object): doc="We use the open telemetry library to automatically instrument the weblogs instead of using the DD library. This scenario represents this case in the integration with different external systems, for example the interaction with sql database.", ) - profiling = EndToEndScenario( - "PROFILING", - library_interface_timeout=160, - agent_interface_timeout=160, - weblog_env={ - "DD_PROFILING_ENABLED": "true", - "DD_PROFILING_UPLOAD_PERIOD": "10", - "DD_PROFILING_START_DELAY": "1", - # Used within Spring Boot native tests to test profiling without affecting tracing scenarios - "USE_NATIVE_PROFILING": "presence", - # Reduce noise - "DD_INSTRUMENTATION_TELEMETRY_ENABLED": "false", - }, - doc="Test profiling feature. Not included in default scenario because is quite slow", - scenario_groups=[ScenarioGroup.PROFILING], - require_api_key=True, # for an unknown reason, /flush on nodejs takes days with a fake key on this scenario - ) + profiling = ProfilingScenario("PROFILING") sampling = EndToEndScenario( "SAMPLING", diff --git a/utils/_context/_scenarios/profiling.py b/utils/_context/_scenarios/profiling.py new file mode 100644 index 0000000000..0bf359d5cc --- /dev/null +++ b/utils/_context/_scenarios/profiling.py @@ -0,0 +1,22 @@ +from .core import ScenarioGroup +from .endtoend import EndToEndScenario + + +class ProfilingScenario(EndToEndScenario): + def __init__(self, name) -> None: + super().__init__( + name, + library_interface_timeout=160, + weblog_env={ + "DD_PROFILING_ENABLED": "true", + "DD_PROFILING_UPLOAD_PERIOD": "10", + "DD_PROFILING_START_DELAY": "1", + # Used within Spring Boot native tests to test profiling without affecting tracing scenarios + "USE_NATIVE_PROFILING": "presence", + # Reduce noise + "DD_INSTRUMENTATION_TELEMETRY_ENABLED": "false", + }, + doc="Test profiling feature. Not included in default scenario because is quite slow", + scenario_groups=[ScenarioGroup.PROFILING], + require_api_key=True, # for an unknown reason, /flush on nodejs takes days with a fake key on this scenario + ) diff --git a/utils/scripts/compute_impacted_scenario.py b/utils/scripts/compute_impacted_scenario.py index 216799f567..7a719e2ad8 100644 --- a/utils/scripts/compute_impacted_scenario.py +++ b/utils/scripts/compute_impacted_scenario.py @@ -160,6 +160,8 @@ def main(): r"utils/_context/_scenarios/integrations\.py": ScenarioGroup.INTEGRATIONS.value, #### Docker SSI case r"utils/docker_ssi/.*": ScenarioGroup.DOCKER_SSI.value, + ### Profiling case + r"utils/_context/_scenarios/profiling\.py": ScenarioGroup.PROFILING.value, ### else, run all r"utils/.*": ScenarioGroup.ALL.value, ## few files with no effect