Skip to content

Commit

Permalink
Split out distributed tracing test into its own test to isolate possi…
Browse files Browse the repository at this point in the history
…ble flake.
  • Loading branch information
wantsui committed Feb 3, 2025
1 parent d140e15 commit bc22dc7
Showing 1 changed file with 51 additions and 1 deletion.
52 changes: 51 additions & 1 deletion tests/contrib/falcon/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,56 @@ def test_inferred_spans_api_gateway_default(self):
"x-dd-proxy-domain-name": "local",
"x-dd-proxy-stage": "stage",
}
for setting_enabled in [False, True]:
for test_headers in [headers]:
for test_endpoint in [
{
"endpoint": "/200",
"status": 200,
"resource_name": "GET tests.contrib.falcon.app.resources.Resource200",
"http.route": "/200",
},
{
"endpoint": "/exception",
"status": 500,
"resource_name": "GET tests.contrib.falcon.app.resources.ResourceException",
"http.route": "/exception",
},
]:
with override_global_config(dict(_inferred_proxy_services_enabled=setting_enabled)):
self.make_test_call(test_endpoint["endpoint"], headers=test_headers)
traces = self.tracer.pop_traces()
if setting_enabled:
aws_gateway_span = traces[0][0]
web_span = traces[0][1]

assert_web_and_inferred_aws_api_gateway_span_data(
aws_gateway_span,
web_span,
web_span_name="falcon.request",
web_span_component="falcon",
web_span_service_name="falcon",
web_span_resource=test_endpoint["resource_name"],
api_gateway_service_name="local",
api_gateway_resource="GET /",
method="GET",
route="/",
status_code=test_endpoint["status"],
url="local/",
start=1736973768.0,
is_distributed=test_headers == distributed_headers,
distributed_trace_id=1,
distributed_parent_id=2,
distributed_sampling_decision=True,
distributed_sampling_priority=USER_KEEP,
)

else:
web_span = traces[0][0]
assert web_span._parent is None

def test_inferred_spans_api_gateway_distributed(self):
# test to split them out to see if this is still flaky
distributed_headers = {
"x-dd-proxy": "aws-apigateway",
"x-dd-proxy-request-time-ms": "1736973768000",
Expand All @@ -311,7 +361,7 @@ def test_inferred_spans_api_gateway_default(self):
}

for setting_enabled in [False, True]:
for test_headers in [distributed_headers, headers]:
for test_headers in [distributed_headers]:
for test_endpoint in [
{
"endpoint": "/200",
Expand Down

0 comments on commit bc22dc7

Please sign in to comment.