@@ -179,6 +179,14 @@ def _wrap(*args, **kwargs):
179179 ),
180180 ),
181181 ("lambda-url" , None ),
182+ (
183+ "rum-appsync" ,
184+ Context (
185+ trace_id = 12345 ,
186+ span_id = 67890 ,
187+ sampling_priority = 1 ,
188+ )
189+ ),
182190 ("s3" , None ),
183191 (
184192 "sns-b64-msg-attribute" ,
@@ -526,6 +534,77 @@ def test_with_sqs_distributed_w3c_trace_data(self):
526534 }
527535 self .common_tests_with_trace_context_extraction_injection (headers , sqs_event )
528536
537+ @with_trace_propagation_style ("datadog" )
538+ def test_with_request_header_datadog_trace_data (self ):
539+ """Test trace data extraction from event['request']['headers']"""
540+ headers = {
541+ TraceHeader .TRACE_ID : "12345" ,
542+ TraceHeader .PARENT_ID : "67890" ,
543+ TraceHeader .SAMPLING_PRIORITY : "1" ,
544+ }
545+ request_headers = {
546+ "request" : {
547+ "domainName" : "None" ,
548+ "headers" : {
549+ "content-length" : "47" ,
550+ "content-type" : "application/graphql" ,
551+ "host" : "4aowrg2uhvbw5mn7osu6searqi.appsync-api.us-east-1.amazonaws.com" ,
552+ "origin" : "http://localhost:5173" ,
553+ "priority" : "u=1, i" ,
554+ "referer" : "http://localhost:5173/" ,
555+ "traceparent" : "00-0000000000000000d9f454c80b9a529a-73ac6ca3427073a3-01" ,
556+ "tracestate" : "dd=s:1;o:rum" ,
557+ "user-agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36" ,"via" :"2.0 62f9f3967e93a923f21c8acb20cf10b6.cloudfront.net (CloudFront)" ,
558+ "x-amz-cf-id" : "Femhicb_Vbva-J8qWjdI4hKMmqusCeQSp207UGyY3u8VOUrdE8BBvg==" ,
559+ "x-amzn-appsync-is-vpce-request" : "False" ,
560+ "x-amzn-remote-ip" : "64.124.12.19" ,
561+ "x-amzn-requestid" : "1ee1669a-eda3-4d4f-911c-35f74ebef31d" ,
562+ "x-amzn-trace-id" : "Root=1-68cdb7e9-438bf88259d7ce3535723bdd" ,
563+ "x-datadog-parent-id" : "67890" ,
564+ "x-datadog-sampling-priority" : "1" ,
565+ "x-datadog-trace-id" : "12345" ,
566+ "x-forwarded-for" : "64.124.12.19,15.158.225.229" ,
567+ "x-forwarded-port" : "443" ,
568+ "x-forwarded-proto" : "https"
569+ }
570+ },
571+ }
572+ self .common_tests_with_trace_context_extraction_injection (headers , request_headers )
573+
574+ @with_trace_propagation_style ("tracecontext" )
575+ def test_with_request_header_w3_trace_data (self ):
576+ """Test trace data extraction from event['request']['headers']"""
577+ headers = {
578+ "traceparent" : "00-0000000000000000d9f454c80b9a529a-73ac6ca3427073a3-01" ,
579+ "tracestate" : "dd=s:1;o:rum" ,
580+ }
581+ request_headers = {
582+ "request" : {
583+ "domainName" : "None" ,
584+ "headers" : {
585+ "content-length" : "47" ,
586+ "content-type" : "application/graphql" ,
587+ "host" : "4aowrg2uhvbw5mn7osu6searqi.appsync-api.us-east-1.amazonaws.com" ,
588+ "origin" : "http://localhost:5173" ,
589+ "priority" : "u=1, i" ,
590+ "referer" : "http://localhost:5173/" ,
591+ "traceparent" : "00-0000000000000000d9f454c80b9a529a-73ac6ca3427073a3-01" ,
592+ "tracestate" : "dd=s:1;o:rum" ,
593+ "user-agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36" ,"via" :"2.0 62f9f3967e93a923f21c8acb20cf10b6.cloudfront.net (CloudFront)" ,
594+ "x-amz-cf-id" : "Femhicb_Vbva-J8qWjdI4hKMmqusCeQSp207UGyY3u8VOUrdE8BBvg==" ,
595+ "x-amzn-appsync-is-vpce-request" : "False" ,
596+ "x-amzn-remote-ip" : "64.124.12.19" ,
597+ "x-amzn-requestid" : "1ee1669a-eda3-4d4f-911c-35f74ebef31d" ,
598+ "x-amzn-trace-id" : "Root=1-68cdb7e9-438bf88259d7ce3535723bdd" ,
599+ "x-forwarded-for" : "64.124.12.19,15.158.225.229" ,
600+ "x-forwarded-port" : "443" ,
601+ "x-forwarded-proto" : "https"
602+ }
603+ },
604+ }
605+ self .common_tests_with_trace_context_extraction_injection (headers , request_headers )
606+
607+
529608 @with_trace_propagation_style ("datadog" )
530609 def test_with_legacy_client_context_datadog_trace_data (self ):
531610 headers = {
0 commit comments