Skip to content
Open
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 @@ -177,6 +177,9 @@ jobs:
- name: Run SECURITY_SMOKE scenario
if: steps.build.outcome == 'success' && !cancelled() && contains(inputs.scenarios, '"SECURITY_SMOKE"')
run: ./run.sh SECURITY_SMOKE
- name: Run SECURITY_SMOKE_OTLP scenario
if: steps.build.outcome == 'success' && !cancelled() && contains(inputs.scenarios, '"SECURITY_SMOKE_OTLP"')
run: ./run.sh SECURITY_SMOKE_OTLP
- name: Run APPSEC_APM_STANDALONE scenario
if: steps.build.outcome == 'success' && !cancelled() && contains(inputs.scenarios, '"APPSEC_APM_STANDALONE"')
run: ./run.sh APPSEC_APM_STANDALONE
Expand Down
7 changes: 7 additions & 0 deletions docs/execute/binaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ But we often want to run system tests against unmerged changes. The general appr
## Agent

* Add a file `agent-image` in `binaries/`. The content must be a valid docker image name containing the datadog agent, like `datadog/agent` or `datadog/agent-dev:master-py3`.
* `SECURITY_SMOKE_OTLP` uses `datadog/agent:latest-full` by default. Set `binaries/ddot-agent-image` to override it with a full image containing the updated `otel-agent`. Replacing only the standalone `trace-agent` binary does not change bundled DDOT conversion.

To check a DDOT conversion fix, use the same weblog image for both runs and change only `binaries/ddot-agent-image`. For example, with a Java tracer that exports structured reports over OTLP, run the following against the unfixed and fixed images. `--runxfail` makes a broken carrier an ordinary failure instead of an expected failure:

```bash
./run.sh SECURITY_SMOKE_OTLP --runxfail tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_Rasp
```

### Building an agent image from a local datadog-agent branch

Expand Down
9 changes: 9 additions & 0 deletions manifests/agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ manifest:
tests/appsec/smoke_tests/test_apm_standalone.py:
- component_version: "<7.77.0-0"
declaration: irrelevant (APM Standalone option was added in 7.77.0)
# RASP requires a structured _dd.stack at intake (no JSON-tag fallback).
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_Rasp: "missing_feature (Bundled DDOT does not restore OTLP report bytes to MetaStruct; datadog-agent#60077)"
# These checks also require DDOT conversion on Python; other SDKs can use _dd.appsec.json.
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_RemoteConfig:
- declaration: "missing_feature (Bundled DDOT does not restore OTLP report bytes to MetaStruct; datadog-agent#60077)"
weblog: [aiohttp, django-poc, django-py3.13, fastapi, flask-poc, python3.12, tornado, uds-flask, uwsgi-poc]
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_Threats::test_attack_detection_smoke:
- declaration: "missing_feature (Bundled DDOT does not restore OTLP report bytes to MetaStruct; datadog-agent#60077)"
weblog: [aiohttp, django-poc, django-py3.13, fastapi, flask-poc, python3.12, tornado, uds-flask, uwsgi-poc]
tests/auto_inject/test_auto_inject_install.py::TestSimpleInstallerAutoInjectManualOriginDetection::test_origin_detection:
- declaration: flaky (APMSP-3059)
weblog: [test-app-java-alpine, test-app-java-container]
Expand Down
1 change: 1 addition & 0 deletions manifests/c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
manifest:
tests/ai_guard/: irrelevant (dd-trace-c does not implement AI Guard)
tests/appsec/: irrelevant (dd-trace-c does not implement AppSec or IAST)
tests/appsec/smoke_tests/test_security_otlp.py: missing_feature (OTLP trace export is not supported)
tests/cws/test_thread_context_sharing.py::Test_ThreadContextSharing: missing_feature (missing /security/thread_context_sharing endpoint on weblog)
tests/ffe/test_evaluation_telemetry_opt_out.py: incomplete_test_app (The Perl Mojolicious workload does not provide the /ffe endpoint)
tests/integrations/test_dbm.py: incomplete_test_app (The Perl Mojolicious workload does not provide database endpoints)
Expand Down
1 change: 1 addition & 0 deletions manifests/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
manifest:
tests/appsec/api_security/test_endpoints.py: irrelevant (language not implementing this feature)
tests/appsec/iast/source/test_parameter_value.py::TestParameterValue::test_source_reported: irrelevant
tests/appsec/smoke_tests/test_security_otlp.py: missing_feature (OTLP trace export is not supported)
tests/appsec/test_agentic_onboarding.py::Test_AppsecAgenticOnboarding: missing_feature
tests/appsec/test_only_python.py::Test_ImportError: irrelevant (specific tests for python tracer)
tests/appsec/test_traces.py::Test_AppSecEventSpanTags::test_header_collection: irrelevant (test)
Expand Down
1 change: 1 addition & 0 deletions manifests/cpp_httpd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ manifest:
tests/appsec/: irrelevant (ASM is not implemented in C++)
tests/appsec/api_security/test_endpoints.py: irrelevant (language not implementing this feature)
tests/appsec/iast/source/test_parameter_value.py::TestParameterValue::test_source_reported: irrelevant
tests/appsec/smoke_tests/test_security_otlp.py: missing_feature (OTLP trace export is not supported)
tests/appsec/test_only_python.py::Test_ImportError: irrelevant (specific tests for python tracer)
tests/appsec/test_traces.py::Test_AppSecEventSpanTags::test_header_collection: irrelevant (test)
tests/appsec/waf/test_reports.py::Test_Monitoring::test_waf_monitoring_optional: irrelevant (optional tags)
Expand Down
1 change: 1 addition & 0 deletions manifests/cpp_kong.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ manifest:
tests/ai_guard/: irrelevant (Kong is a proxy, not an application)
tests/apm_tracing_e2e/: missing_feature (missing endpoints on weblog)
tests/appsec/: irrelevant (ASM is not implemented in Kong plugin)
tests/appsec/smoke_tests/test_security_otlp.py: missing_feature (OTLP trace export is not supported)
tests/cws/test_thread_context_sharing.py::Test_ThreadContextSharing: missing_feature (missing /security/thread_context_sharing endpoint on weblog)
tests/debugger/: irrelevant
tests/ffe/: missing_feature
Expand Down
1 change: 1 addition & 0 deletions manifests/cpp_nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ manifest:
tests/appsec/smoke_tests/test_security.py::Test_SecuritySmoke_Threats: '>=1.19.1'
tests/appsec/smoke_tests/test_security.py::Test_SecuritySmoke_Threats::test_waf_monitoring_smoke: missing_feature (WAF monitoring tags not implemented)
tests/appsec/smoke_tests/test_security.py::Test_SecuritySmoke_UserEvents: missing_feature
tests/appsec/smoke_tests/test_security_otlp.py: missing_feature (OTLP trace export is not supported)
tests/appsec/test_agentic_onboarding.py::Test_AppsecAgenticOnboarding: missing_feature
tests/appsec/test_alpha.py: irrelevant (ASM is not implemented in C++)
tests/appsec/test_asm_standalone.py::Test_APISecurityStandalone: '>=1.12.0' # Modified by easy win activation script
Expand Down
4 changes: 4 additions & 0 deletions manifests/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ manifest:
tests/appsec/rasp/test_ssrf.py::Test_Ssrf_Waf_Version: v3.4.1
tests/appsec/smoke_tests/test_apm_standalone.py: v3.41.0
tests/appsec/smoke_tests/test_security.py: v3.41.0
tests/appsec/smoke_tests/test_security_otlp.py: v3.41.0
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_Rasp: "missing_feature (The .NET OTLP exporter does not emit the security report and metadata; dd-trace-dotnet#9715)"
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_RemoteConfig: "missing_feature (The .NET OTLP exporter does not emit the security report and metadata; dd-trace-dotnet#9715)"
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_Threats: "missing_feature (The .NET OTLP exporter does not emit the security report and metadata; dd-trace-dotnet#9715)"
tests/appsec/test_agentic_onboarding.py::Test_AppsecAgenticOnboarding: v3.50.0
tests/appsec/test_alpha.py::Test_Basic: v1.28.6
tests/appsec/test_asm_standalone.py::Test_APISecurityStandalone: v3.17.0
Expand Down
23 changes: 23 additions & 0 deletions manifests/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,29 @@ manifest:
- declaration: missing_feature (Fiber v2 has no HTTP AppSec integration)
weblog: fiber-v2-orchestrion
tests/appsec/smoke_tests/test_security.py::Test_SecuritySmoke_UserEvents: missing_feature
tests/appsec/smoke_tests/test_security_otlp.py:
- weblog_declaration:
"*": v2.8.0
fiber-v2-orchestrion: v2.12.0
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_Rasp: missing_feature (The Go exporter does not encode structured reports as MessagePack byte attributes)
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_Rasp::test_lfi_smoke:
- weblog_declaration:
'*': irrelevant (LFI detection requires Orchestrion)
fiber-v2-orchestrion: missing_feature (The Fiber weblog does not report the LFI rule match)
net-http-orchestrion: v2.7.0
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_Rasp::test_shi_smoke: irrelevant (there is no equivalent to system(3) in go)
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_RemoteConfig:
- declaration: "missing_feature (Go does not export the AppSec JSON fallback over OTLP; dd-trace-go#5678)"
component_version: '<2.13.0-dev.1'
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_RemoteConfig::test_rasp_blocking_smoke:
- weblog_declaration:
'*': irrelevant (LFI detection requires Orchestrion)
fiber-v2-orchestrion: missing_feature (The Fiber weblog does not block LFI after the RC rule update)
net-http-orchestrion: v2.7.0
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_Threats::test_attack_detection_smoke:
- declaration: "missing_feature (Go does not export the AppSec JSON fallback over OTLP; dd-trace-go#5678)"
component_version: '<2.13.0-dev.1'
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_UserEvents: incomplete_test_app (The Go weblogs do not implement the /login endpoint)
tests/appsec/test_agentic_onboarding.py::Test_AppsecAgenticOnboarding:
- weblog_declaration:
"*": v2.11.0-dev
Expand Down
24 changes: 24 additions & 0 deletions manifests/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,30 @@ manifest:
resteasy-netty3: incomplete_test_app (login endpoints not implemented)
vertx3: incomplete_test_app (login endpoints not implemented)
vertx4: incomplete_test_app (login endpoints not implemented)
tests/appsec/smoke_tests/test_security_otlp.py:
- weblog_declaration:
"*": v1.62.0
spring-boot-3-native: irrelevant (GraalVM. Tracing support only)
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_Rasp:
- declaration: "missing_feature (The Java exporter does not emit OTLP structured reports; dd-trace-java#13391)"
component_version: '<1.70.0-SNAPSHOT'
- weblog_declaration:
spring-boot-payara: v1.66.0
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_Rasp::test_ssrf_smoke:
- weblog_declaration:
vertx3, vertx4: missing_feature (APPSEC-55781)
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_RemoteConfig::test_rasp_blocking_smoke:
- weblog_declaration:
spring-boot-payara: missing_feature (APPSEC-54966)
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_UserEvents:
- weblog_declaration:
akka-http: incomplete_test_app (login endpoints not implemented)
jersey-grizzly2: incomplete_test_app (login endpoints not implemented)
play: incomplete_test_app (login endpoints not implemented)
ratpack: incomplete_test_app (login endpoints not implemented)
resteasy-netty3: incomplete_test_app (login endpoints not implemented)
vertx3: incomplete_test_app (login endpoints not implemented)
vertx4: incomplete_test_app (login endpoints not implemented)
tests/appsec/test_agentic_onboarding.py::Test_AppsecAgenticOnboarding:
- weblog_declaration:
"*": v1.65.0-SNAPSHOT
Expand Down
11 changes: 11 additions & 0 deletions manifests/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,17 @@ manifest:
- weblog_declaration:
fastify: missing_feature
nextjs: missing_feature
tests/appsec/smoke_tests/test_security_otlp.py: *ref_5_98_0
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_Rasp:
- declaration: missing_feature (The Node.js exporter encodes structured reports as JSON bytes rather than MessagePack)
- weblog_declaration:
nextjs: v6.19.0
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_RemoteConfig::test_rasp_blocking_smoke:
- weblog_declaration:
nextjs: missing_feature
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_UserEvents:
- weblog_declaration:
fastify, nextjs: incomplete_test_app (The weblog does not implement the /login endpoint)
tests/appsec/test_agentic_onboarding.py::Test_AppsecAgenticOnboarding: *ref_6_5_0
tests/appsec/test_alpha.py::Test_Basic: v2.0.0
tests/appsec/test_asm_standalone.py::BaseSCAStandaloneTelemetry::test_app_dependencies_loaded:
Expand Down
1 change: 1 addition & 0 deletions manifests/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ manifest:
weblog: [apache-mod-8.1-zts, apache-mod-7.4-zts, apache-mod-7.2-zts, php-fpm-8.1, apache-mod-8.2-zts, apache-mod-8.2, php-fpm-7.0, apache-mod-7.0, php-fpm-8.0, apache-mod-7.2, apache-mod-7.1-zts, apache-mod-7.3-zts, apache-mod-7.1, php-fpm-7.3, apache-mod-8.1, symfony7x, apache-mod-7.4, apache-mod-7.3, php-fpm-7.1, apache-mod-8.0, php-fpm-8.5, php-fpm-8.6, php-fpm-8.2, apache-mod-8.0-zts, php-fpm-7.4, apache-mod-7.0-zts, laravel11x, php-fpm-7.2]
- declaration: bug (APPSEC-69429)
excluded_weblog: [apache-mod-8.1-zts, apache-mod-7.4-zts, apache-mod-7.2-zts, php-fpm-8.1, apache-mod-8.2-zts, apache-mod-8.2, php-fpm-7.0, apache-mod-7.0, php-fpm-8.0, apache-mod-7.2, apache-mod-7.1-zts, apache-mod-7.3-zts, apache-mod-7.1, php-fpm-7.3, apache-mod-8.1, symfony7x, apache-mod-7.4, apache-mod-7.3, php-fpm-7.1, apache-mod-8.0, php-fpm-8.5, php-fpm-8.6, php-fpm-8.2, apache-mod-8.0-zts, php-fpm-7.4, apache-mod-7.0-zts, laravel11x, php-fpm-7.2]
tests/appsec/smoke_tests/test_security_otlp.py: missing_feature (OTLP trace export is not supported)
tests/appsec/test_agentic_onboarding.py::Test_AppsecAgenticOnboarding: v1.24.0+dev
tests/appsec/test_asm_standalone.py::Test_APISecurityStandalone: v1.11.0
tests/appsec/test_asm_standalone.py::Test_AppSecStandalone_APMDisabledMarker: # TODO: a lower version might be supported
Expand Down
13 changes: 13 additions & 0 deletions manifests/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,19 @@ manifest:
tests/appsec/smoke_tests/test_security.py::Test_SecuritySmoke_Threats:
- weblog_declaration:
aiohttp: v4.17.0-rc1
tests/appsec/smoke_tests/test_security_otlp.py: v4.11.0
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_ApiSecurity:
- weblog_declaration:
aiohttp: v4.17.0-rc1
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_Rasp:
- weblog_declaration:
aiohttp: v4.17.0-rc1
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_RemoteConfig:
- weblog_declaration:
aiohttp: v4.17.0-rc1
tests/appsec/smoke_tests/test_security_otlp.py::Test_SecuritySmokeOtlp_Threats:
- weblog_declaration:
aiohttp: v4.17.0-rc1
tests/appsec/test_agentic_onboarding.py::Test_AppsecAgenticOnboarding: v4.13.0rc1
tests/appsec/test_alpha.py:
- weblog_declaration:
Expand Down
1 change: 1 addition & 0 deletions manifests/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,7 @@ manifest:
sinatra32: missing_feature (no instrumentation of authentication frameworks that work with sinatra or rack)
sinatra41: missing_feature (no instrumentation of authentication frameworks that work with sinatra or rack)
uds-sinatra: missing_feature (no instrumentation of authentication frameworks that work with sinatra or rack)
tests/appsec/smoke_tests/test_security_otlp.py: missing_feature (OTLP trace export is not supported)
tests/appsec/test_agentic_onboarding.py::Test_AppsecAgenticOnboarding: v2.40.0-dev
tests/appsec/test_asm_standalone.py::Test_APISecurityStandalone: v2.18.0
tests/appsec/test_asm_standalone.py::Test_AppSecStandalone_APMDisabledMarker: # TODO: a lower version might be supported
Expand Down
1 change: 1 addition & 0 deletions manifests/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ manifest:
tests/apm_tracing_e2e/test_process_tags.py::Test_Process_Tags: missing_feature (process tags not implemented)
tests/apm_tracing_e2e/test_single_span.py::Test_SingleSpan: missing_feature (single-span sampling is not implemented)
tests/appsec/: irrelevant (AppSec/IAST/RASP is not implemented in dd-trace-rs)
tests/appsec/smoke_tests/test_security_otlp.py: missing_feature (OTLP trace export is not supported)
tests/auto_inject/test_auto_inject_install.py::TestContainerAutoInjectInstallScriptAppsec: missing_feature
tests/auto_inject/test_auto_inject_install.py::TestHostAutoInjectInstallScriptAppsec: missing_feature
tests/auto_inject/test_auto_inject_install.py::TestSimpleInstallerAutoInjectManualAppsec: missing_feature
Expand Down
4 changes: 4 additions & 0 deletions mirror_images.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ images:
digest: sha256:161a43ad2b290f7527a70e70c8880c1b3d65b39411552a8cb41398049546daf5
target: registry.ddbuild.io/system-tests/mirror/datadog/agent:latest
tag: 7.84.1
datadog/agent:latest-full:
digest: sha256:0d2b73ea08a6f4a0d7f9b4fe8516a31164fe8ec26116394579eaaa6cf0d0560f
target: registry.ddbuild.io/system-tests/mirror/datadog/agent:latest-full
tag: latest-full
datadog/serverless-init:1.10.4:
digest: sha256:f4943347f155505156ba5f594317ea64b59678b3a6522e8c0993581af20956ff
target: registry.ddbuild.io/system-tests/mirror/datadog/serverless-init:1.10.4
Expand Down
1 change: 1 addition & 0 deletions mirror_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- "apache/kafka:3.7.1"
- "cassandra:latest"
- "datadog/agent:latest"
- "datadog/agent:latest-full"
- "datadog/serverless-init:1.10.4"
- "datadog/system-tests:golang_buddy-v2"
- "datadog/system-tests:java_buddy-v1"
Expand Down
60 changes: 60 additions & 0 deletions tests/appsec/smoke_tests/test_security_otlp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
"""Run the native AAP smoke contracts with OTLP traces converted by bundled DDOT."""

from utils import features, pytest, scenarios
from tests.appsec.smoke_tests.utils import (
BaseApiSecuritySmokeTests,
BaseRaspSmokeTests,
BaseRemoteConfigSmokeTests,
BaseTelemetrySmokeTests,
BaseThreatsSmokeTests,
BaseUserEventsSmokeTests,
assert_ddot_export,
)


@pytest.fixture(autouse=True)
def _require_otlp_export(request: pytest.FixtureRequest) -> None:
assert_ddot_export(request.instance.r)


@features.security_events_metadata
@features.support_in_app_waf_metrics_report
@scenarios.security_smoke_otlp
class Test_SecuritySmokeOtlp_Threats(BaseThreatsSmokeTests):
pass


@features.rasp_local_file_inclusion
@features.rasp_server_side_request_forgery
@features.rasp_sql_injection
@features.rasp_shell_injection
@features.rasp_stack_trace
@features.rasp_span_tags
@scenarios.security_smoke_otlp
class Test_SecuritySmokeOtlp_Rasp(BaseRaspSmokeTests):
pass


@features.waf_telemetry
@scenarios.security_smoke_otlp
class Test_SecuritySmokeOtlp_Telemetry(BaseTelemetrySmokeTests):
pass


@features.threats_configuration
@features.appsec_request_blocking
@scenarios.security_smoke_otlp
class Test_SecuritySmokeOtlp_RemoteConfig(BaseRemoteConfigSmokeTests):
pass


@features.api_security_schemas
@scenarios.security_smoke_otlp
class Test_SecuritySmokeOtlp_ApiSecurity(BaseApiSecuritySmokeTests):
pass


@features.user_monitoring
@scenarios.security_smoke_otlp
class Test_SecuritySmokeOtlp_UserEvents(BaseUserEventsSmokeTests):
pass
17 changes: 17 additions & 0 deletions tests/appsec/smoke_tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from utils._weblog import HttpResponse
from utils.dd_constants import SamplingPriority
from utils.dd_types import DataDogAgentSpan, is_same_boolean
from utils.interfaces._open_telemetry import otlp_trace_id_to_hex

SMOKE_RC_RULE_ID = "smoke-rc-0001"
SMOKE_RC_RASP_RULE_ID = "rasp-930-100"
Expand Down Expand Up @@ -91,6 +92,22 @@
)


def assert_ddot_export(request: HttpResponse) -> None:
accepted_ids = {
f"0x{hex_id}"
for tid in interfaces.open_telemetry.get_otel_trace_id(request, accepted_by="agent")
if (hex_id := otlp_trace_id_to_hex(tid))
}
assert accepted_ids, "DDOT must accept an OTLP trace for this request"
# Match by trace ID even if a native chunk lacks the root span, and by
# request ID in case a fallback produced a new trace. Ignore non-trace traffic.
rid = request.get_rid()
for _, trace in interfaces.library.get_traces():
message = f"Request {rid} was also exported via native trace intake ({trace.log_filename})"
assert not any(trace.trace_id_equals(tid) for tid in accepted_ids), message
assert not any(span.get_rid() == rid for span in trace), message


def _assert_numeric_metric(span: DataDogAgentSpan, name: str) -> float:
value = span.metrics.get(name)
assert isinstance(value, (int, float)), f"Backend should receive numeric {name}"
Expand Down
Loading
Loading