Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into christophe-papazian/e…
Browse files Browse the repository at this point in the history
…nable_user_blocking_for_python
  • Loading branch information
christophe-papazian committed Jan 30, 2025
2 parents 9a82f95 + 91b0379 commit b112148
Show file tree
Hide file tree
Showing 104 changed files with 2,090 additions and 7,735 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
exit 1
system_tests:
name: System Tests ${{ needs.get_dev_artifacts.outputs.target-branch != '' && format('({0} branch)', needs.get_dev_artifacts.outputs.target-branch) || '' }}
name: System Tests
needs:
- lint
- test_the_test
Expand Down Expand Up @@ -157,7 +157,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- system_tests
if: always()
if: '!cancelled()'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
],
"python.testing.pytestEnabled": true,
"ruff.enable": true,
"ruff.interpreter": [
"${workspaceFolder}/venv/bin/python",
"-m",
"ruff"
],
"pylint.ignorePatterns": ["*"]
}
32 changes: 16 additions & 16 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
setup_properties = SetupProperties()


def pytest_addoption(parser):
def pytest_addoption(parser) -> None:
parser.addoption(
"--scenario", "-S", type=str, action="store", default="DEFAULT", help="Unique identifier of scenario"
)
Expand Down Expand Up @@ -129,7 +129,7 @@ def pytest_addoption(parser):
)


def pytest_configure(config):
def pytest_configure(config) -> None:
if not config.option.force_dd_trace_debug and os.environ.get("SYSTEM_TESTS_FORCE_DD_TRACE_DEBUG") == "true":
config.option.force_dd_trace_debug = True

Expand Down Expand Up @@ -168,7 +168,7 @@ def pytest_configure(config):


# Called at the very begening
def pytest_sessionstart(session):
def pytest_sessionstart(session) -> None:
# get the terminal to allow logging directly in stdout
logger.terminal = session.config.pluginmanager.get_plugin("terminalreporter")

Expand Down Expand Up @@ -236,7 +236,7 @@ def _get_skip_reason_from_marker(marker):
return None


def pytest_pycollect_makemodule(module_path, parent):
def pytest_pycollect_makemodule(module_path, parent) -> None:
# As now, declaration only works for tracers at module level

library = context.scenario.library.library
Expand Down Expand Up @@ -265,7 +265,7 @@ def pytest_pycollect_makemodule(module_path, parent):


@pytest.hookimpl(tryfirst=True)
def pytest_pycollect_makeitem(collector, name, obj):
def pytest_pycollect_makeitem(collector, name, obj) -> None:
if collector.istestclass(obj, name):
if obj is None:
message = f"""{collector.nodeid} is not properly collected.
Expand All @@ -286,7 +286,7 @@ def pytest_pycollect_makeitem(collector, name, obj):
raise ValueError(f"Unexpected error for {nodeid}.") from e


def pytest_collection_modifyitems(session, config, items: list[pytest.Item]):
def pytest_collection_modifyitems(session, config, items: list[pytest.Item]) -> None:
"""Unselect items that are not included in the current scenario"""

logger.debug("pytest_collection_modifyitems")
Expand Down Expand Up @@ -349,7 +349,7 @@ def iter_markers(self, name=None):
json.dump(all_declared_scenarios, f, indent=2)


def pytest_deselected(items):
def pytest_deselected(items) -> None:
_deselected_items.extend(items)


Expand All @@ -373,7 +373,7 @@ def _item_is_skipped(item):
return any(item.iter_markers("skip"))


def pytest_collection_finish(session: pytest.Session):
def pytest_collection_finish(session: pytest.Session) -> None:
if session.config.option.collectonly:
return

Expand Down Expand Up @@ -437,20 +437,20 @@ def pytest_collection_finish(session: pytest.Session):
context.scenario.post_setup(session)


def pytest_runtest_call(item):
def pytest_runtest_call(item) -> None:
# add a log line for each request made by the setup, to help debugging
setup_properties.log_requests(item)


@pytest.hookimpl(optionalhook=True)
def pytest_json_runtest_metadata(item, call):
def pytest_json_runtest_metadata(item, call) -> None:
if call.when != "setup":
return {}

return _collect_item_metadata(item)


def pytest_json_modifyreport(json_report):
def pytest_json_modifyreport(json_report) -> None:
try:
# add usefull data for reporting
json_report["context"] = context.serialize()
Expand All @@ -461,7 +461,7 @@ def pytest_json_modifyreport(json_report):
logger.error("Fail to modify json report", exc_info=True)


def pytest_sessionfinish(session, exitstatus):
def pytest_sessionfinish(session, exitstatus) -> None:
logger.info("Executing pytest_sessionfinish")

if session.config.option.skip_empty_scenario and exitstatus == pytest.ExitCode.NO_TESTS_COLLECTED:
Expand Down Expand Up @@ -499,7 +499,7 @@ def pytest_sessionfinish(session, exitstatus):
session.exitstatus = SUCCESS


def export_feature_parity_dashboard(session, data):
def export_feature_parity_dashboard(session, data) -> None:
tests = [convert_test_to_feature_parity_model(test) for test in data["tests"]]

result = {
Expand All @@ -521,7 +521,7 @@ def export_feature_parity_dashboard(session, data):
json.dump(result, f, indent=2)


def convert_test_to_feature_parity_model(test):
def convert_test_to_feature_parity_model(test) -> dict:
result = {
"path": test["nodeid"],
"lineNumber": test["lineno"],
Expand All @@ -537,10 +537,10 @@ def convert_test_to_feature_parity_model(test):

## Fixtures corners
@pytest.fixture(scope="session", name="session")
def fixture_session(request):
def fixture_session(request) -> pytest.Session:
return request.session


@pytest.fixture(scope="session", name="deselected_items")
def fixture_deselected_items():
def fixture_deselected_items() -> list[pytest.Item]:
return _deselected_items
2 changes: 1 addition & 1 deletion docs/edit/runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The impact is that these **configs are not visible** in Metabase, REDAPL, or any

1. Check the test failure to see exactly which configs are missing
2. Add config normalization rules [here](https://github.com/DataDog/dd-go/tree/prod/trace/apps/tracer-telemetry-intake/telemetry-payload/static/) following the existing pattern
1. This can be merged with any review from [@apm-ecosystems](https://github.com/orgs/DataDog/teams/apm-ecosystems)
1. This can be merged with any review from [@apm-sdk](https://github.com/orgs/DataDog/teams/apm-sdk)
2. Bonus Points: Run the auto-formatter [_format.py](https://github.com/DataDog/dd-go/blob/prod/trace/apps/tracer-telemetry-intake/telemetry-payload/static/_format.py) from the `dd-go` root via `python ./trace/apps/tracer-telemetry-intake/telemetry-payload/static/_format.py`
3. After merging, update system-tests by running [update.sh](/tests/telemetry_intake/update.sh)
1. This can be run from the root by running `./tests/telemetry_intake/update.sh`
Expand Down
6 changes: 6 additions & 0 deletions docs/execute/binaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ Create a file `golang-load-from-go-get` under the `binaries` directory that spec
* `gopkg.in/DataDog/[email protected]` Test the 1.67.0 release
* `gopkg.in/DataDog/dd-trace-go.v1@<commit_hash>` Test un-merged changes

To change Orchestrion version, create a file `orchestrion-load-from-go-get` under the `binaries` directory that specifies the target build. The content of this file will be installed by the weblog or parametric app via `go get` when the test image is built.
* Content example:
* `github.com/DataDog/orchestrion@main` Test the main branch
* `github.com/DataDog/[email protected]` Test the 1.1.0 release
* `github.com/DataDog/orchestrion@<commit_hash>` Test un-merged changes

## Java library

Follow these steps to run Parametric tests with a custom Java Tracer version:
Expand Down
32 changes: 28 additions & 4 deletions manifests/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ tests/:
Test_API_Security_Sampling_Rate:
'*': v1.60.0
net-http: irrelevant (net-http doesn't handle path params)
net-http-orchestrion: irrelevant (net-http doesn't handle path params)
Test_API_Security_Sampling_With_Delay: missing_feature
test_schemas.py:
Test_Scanners: missing_feature
Expand All @@ -32,6 +33,7 @@ tests/:
Test_Schema_Request_Path_Parameters:
'*': v1.60.0
net-http: irrelevant (net-http cannot list path params)
net-http-orchestrion: irrelevant (net-http cannot list path params)
Test_Schema_Request_Query_Parameters: v1.60.0
Test_Schema_Response_Body: missing_feature
Test_Schema_Response_Body_env_var: missing_feature
Expand Down Expand Up @@ -217,6 +219,7 @@ tests/:
'*': v1.36.0
gin: v1.37.0
net-http: irrelevant (net-http doesn't handle path params)
net-http-orchestrion: irrelevant (net-http doesn't handle path params)
Test_ResponseStatus:
'*': v1.36.0
gin: v1.37.0
Expand Down Expand Up @@ -308,7 +311,7 @@ tests/:
echo: v1.36.0
gin: v1.37.0
test_asm_standalone.py:
Test_AppSecStandalone_UpstreamPropagation: v1.72.0-dev
Test_AppSecStandalone_UpstreamPropagation: v1.71.0
Test_AppSecStandalone_UpstreamPropagation_V2: missing_feature
Test_IastStandalone_UpstreamPropagation: missing_feature
Test_IastStandalone_UpstreamPropagation_V2: missing_feature
Expand Down Expand Up @@ -337,21 +340,27 @@ tests/:
Test_Blocking_request_cookies:
'*': v1.51.0
net-http: irrelevant
net-http-orchestrion: irrelevant
Test_Blocking_request_headers:
'*': v1.51.0
net-http: irrelevant
net-http-orchestrion: irrelevant
Test_Blocking_request_method:
'*': v1.51.0
net-http: irrelevant
net-http-orchestrion: irrelevant
Test_Blocking_request_path_params:
'*': v1.51.0
net-http: irrelevant
net-http-orchestrion: irrelevant
Test_Blocking_request_query:
'*': v1.51.0
net-http: irrelevant
net-http-orchestrion: irrelevant
Test_Blocking_request_uri:
'*': v1.51.0
net-http: irrelevant
net-http-orchestrion: irrelevant
Test_Blocking_response_headers: missing_feature
Test_Blocking_response_status: missing_feature
Test_Blocking_user_id: v1.51.0
Expand Down Expand Up @@ -457,21 +466,26 @@ tests/:
Test_Kinesis_PROPAGATION_VIA_MESSAGE_ATTRIBUTES:
"*": irrelevant
net-http: missing_feature (Endpoint not implemented)
net-http-orchestrion: missing_feature (Endpoint not implemented)
test_rabbitmq.py:
Test_RabbitMQ_Trace_Context_Propagation:
"*": irrelevant
net-http: missing_feature (Endpoint not implemented)
net-http-orchestrion: missing_feature (Endpoint not implemented)
test_sns_to_sqs.py:
Test_SNS_Propagation:
"*": irrelevant
net-http: missing_feature
net-http-orchestrion: missing_feature (Endpoint not implemented)
test_sqs.py:
Test_SQS_PROPAGATION_VIA_AWS_XRAY_HEADERS:
"*": irrelevant
net-http: missing_feature (Endpoint not implemented)
net-http-orchestrion: missing_feature (Endpoint not implemented)
Test_SQS_PROPAGATION_VIA_MESSAGE_ATTRIBUTES:
"*": irrelevant
net-http: missing_feature (Endpoint not implemented)
net-http-orchestrion: missing_feature (Endpoint not implemented)
test_db_integrations_sql.py:
Test_MsSql: missing_feature
Test_MySql: missing_feature
Expand All @@ -492,27 +506,35 @@ tests/:
Test_DsmKinesis:
"*": irrelevant
net-http: missing_feature (Endpoint not implemented)
net-http-orchestrion: missing_feature (Endpoint not implemented)
Test_DsmRabbitmq:
"*": irrelevant
net-http: missing_feature (Endpoint not implemented)
net-http-orchestrion: missing_feature (Endpoint not implemented)
Test_DsmRabbitmq_FanoutExchange:
"*": irrelevant
net-http: missing_feature (Endpoint not implemented)
net-http-orchestrion: missing_feature (Endpoint not implemented)
Test_DsmRabbitmq_TopicExchange:
"*": irrelevant
net-http: missing_feature (Endpoint not implemented)
net-http-orchestrion: missing_feature (Endpoint not implemented)
Test_DsmSNS:
"*": irrelevant
net-http: missing_feature (Endpoint not implemented)
net-http-orchestrion: missing_feature (Endpoint not implemented)
Test_DsmSQS:
"*": irrelevant
net-http: missing_feature (Endpoint not implemented)
net-http-orchestrion: missing_feature (Endpoint not implemented)
Test_Dsm_Manual_Checkpoint_Inter_Process:
"*": irrelevant
net-http: missing_feature (Endpoint not implemented)
net-http-orchestrion: missing_feature (Endpoint not implemented)
Test_Dsm_Manual_Checkpoint_Intra_Process:
"*": irrelevant
net-http: missing_feature (Endpoint not implemented)
net-http-orchestrion: missing_feature (Endpoint not implemented)
test_inferred_proxy.py:
Test_AWS_API_Gateway_Inferred_Span_Creation: missing_feature
test_otel_drop_in.py:
Expand Down Expand Up @@ -589,10 +611,12 @@ tests/:
Test_Config_ClientIPHeaderEnabled_False: v1.70.1
Test_Config_ClientIPHeader_Configured: v1.60.0
Test_Config_ClientIPHeader_Precedence: v1.69.0
Test_Config_ClientTagQueryString_Configured: missing_feature (supports DD_TRACE_HTTP_URL_QUERY_STRING_DISABLED)
Test_Config_ClientTagQueryString_Empty: bug (APMAPI-966) # DD_TRACE_HTTP_CLIENT_TAG_QUERY_STRING is disabled by default
Test_Config_ClientTagQueryString_Configured: v1.72.0-dev
Test_Config_ClientTagQueryString_Empty: v1.72.0-dev
Test_Config_HttpClientErrorStatuses_Default: v1.69.0
Test_Config_HttpClientErrorStatuses_FeatureFlagCustom: v1.69.0
Test_Config_HttpClientErrorStatuses_FeatureFlagCustom:
'*': v1.69.0
net-http-orchestrion: v1.72.0-dev
Test_Config_HttpServerErrorStatuses_Default: v1.67.0
Test_Config_HttpServerErrorStatuses_FeatureFlagCustom:
"*": v1.69.0
Expand Down
8 changes: 7 additions & 1 deletion manifests/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ refs:
- &ref_5_30_0 '>=5.30.0 || ^4.54.0'
- &ref_5_32_0 '>=5.32.0'
- &ref_5_33_0 '>=5.33.0'
- &ref_5_34_0 '>=5.34.0'

tests/:
apm_tracing_e2e/:
Expand Down Expand Up @@ -912,7 +913,12 @@ tests/:
Test_Synthetics_APM_Datadog:
'*': *ref_5_25_0
nextjs: bug (APMAPI-939) # the nextjs weblog application changes the sampling priority from 1.0 to 2.0
test_graphql.py: missing_feature
test_graphql.py:
Test_GraphQLQueryErrorReporting:
'*': *ref_5_34_0
express4-typescript: incomplete_test_app (endpoint not implemented)
express5: missing_feature
nextjs: missing_feature
test_identify.py:
Test_Basic: v2.4.0
Test_Propagate: *ref_3_2_0
Expand Down
6 changes: 3 additions & 3 deletions manifests/parser/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _load_file(file):


@lru_cache
def load(base_dir="manifests/"):
def load(base_dir="manifests/") -> dict:
"""Returns a dict of nodeid, value are another dict where the key is the component
and the value the declaration. It is meant to sent directly the value of a nodeid to @released.
Expand Down Expand Up @@ -74,7 +74,7 @@ def load(base_dir="manifests/"):
return result


def assert_key_order(obj: dict, path=""):
def assert_key_order(obj: dict, path="") -> None:
last_key = "/"

for key, value in obj.items():
Expand All @@ -91,7 +91,7 @@ def assert_key_order(obj: dict, path=""):
last_key = key


def validate_manifest_files():
def validate_manifest_files() -> None:
with open("manifests/parser/schema.json", encoding="utf-8") as f:
schema = json.load(f)

Expand Down
2 changes: 1 addition & 1 deletion manifests/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ tests/:
sink/:
test_code_injection.py:
TestCodeInjection: v2.20.0
TestCodeInjection_StackTrace: missing_feature
TestCodeInjection_StackTrace: v2.20.0
test_command_injection.py:
TestCommandInjection:
'*': v2.10.0
Expand Down
Loading

0 comments on commit b112148

Please sign in to comment.