Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/run-end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ jobs:
- name: Run APPSEC_STANDALONE_V2 scenario
if: always() && steps.build.outcome == 'success' && contains(inputs.scenarios, '"APPSEC_STANDALONE_V2"')
run: ./run.sh APPSEC_STANDALONE_V2
- name: Run APPSEC_NO_STATS scenario
if: always() && steps.build.outcome == 'success' && contains(inputs.scenarios, '"APPSEC_NO_STATS"')
run: ./run.sh APPSEC_NO_STATS
- name: Run IAST_STANDALONE scenario
if: always() && steps.build.outcome == 'success' && contains(inputs.scenarios, '"IAST_STANDALONE"')
run: ./run.sh IAST_STANDALONE
Expand Down
1 change: 1 addition & 0 deletions manifests/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ tests/:
test_telemetry.py:
Test_TelemetryMetrics: missing_feature
test_asm_standalone.py:
Test_AppSecStandalone_NotEnabled: v1.6.2
Test_AppSecStandalone_UpstreamPropagation: v1.6.0
Test_AppSecStandalone_UpstreamPropagation_V2: missing_feature
Test_IastStandalone_UpstreamPropagation: missing_feature
Expand Down
26 changes: 26 additions & 0 deletions tests/appsec/test_asm_standalone.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if there is a current test in another scenario that checks this datadog-client-computed-stats header, but IMHO we need one more test case that checks datadog-client-computed-stats=true when standalone billing is disabled and metrics enabled, to ensure the previous is working as before the asm feature was implemented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I'm following you correctly. How would you make APM to send the header datadog-client-computed-stats=true? In PHP that header was not sent

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's something that only happens in java, but the header is set with empty value, but to keep it simple we can continue with the PR as it is

Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,32 @@ def test_app_dependencies_loaded(self):
raise Exception(dependency + " not received in app-dependencies-loaded message")


@rfc("https://docs.google.com/document/d/12NBx-nD-IoQEMiCRnJXneq4Be7cbtSc6pJLOFUWTpNE/edit")
@features.appsec_standalone
@scenarios.appsec_no_stats
class Test_AppSecStandalone_NotEnabled:
"""Test expected behaviour when standalone is not enabled."""

def setup_client_computed_stats_header_is_not_present(self):
trace_id = 1212121212121212122
parent_id = 34343434
self.r = weblog.get(
"/",
headers={
"x-datadog-trace-id": str(trace_id),
"x-datadog-parent-id": str(parent_id),
},
)

def test_client_computed_stats_header_is_not_present(self):
spans_checked = 0
for data, _, span in interfaces.library.get_spans(request=self.r):
assert span["trace_id"] == 1212121212121212122
assert "datadog-client-computed-stats" not in [x.lower() for x, y in data["request"]["headers"]]
spans_checked += 1
assert spans_checked == 1


@rfc("https://docs.google.com/document/d/12NBx-nD-IoQEMiCRnJXneq4Be7cbtSc6pJLOFUWTpNE/edit")
@features.appsec_standalone
@scenarios.appsec_standalone
Expand Down
9 changes: 9 additions & 0 deletions utils/_context/_scenarios/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ class _Scenarios:

profiling = ProfilingScenario("PROFILING")

appsec_no_stats = EndToEndScenario(
"End to end tests with default value of DD_TRACE_COMPUTE_STATS",
doc=(
"End to end testing with default values. Default scenario has DD_TRACE_COMPUTE_STATS=true."
"This scenario let that env to use its default"
),
scenario_groups=[ScenarioGroup.APPSEC],
)

sampling = EndToEndScenario(
"SAMPLING",
tracer_sampling_rate=0.5,
Expand Down
Loading