-
Notifications
You must be signed in to change notification settings - Fork 46
APMSVLS-65 Extract Trace Context For AppSync Events #657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
870ed87
8a2c8b5
4954749
ed0b485
d513e9e
8b5ed4e
d86688b
a7aeef1
58b3b09
07ead6d
5d04656
0b6523a
804c406
3a08efd
794791a
e7c56a4
09d67d4
cefcd5f
76c8bb2
b46efbb
4c48de7
6bd15cb
83f97df
5a3ad86
937b371
1eec519
006caee
7ad64c5
c532190
fab3c92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| { | ||
| "identity": "None", | ||
| "info": { | ||
| "fieldName": "getItems", | ||
| "parentTypeName": "Query", | ||
| "selectionSetGraphQL": "{\n id\n}", | ||
| "selectionSetList":["id"] | ||
| }, | ||
| "prev": "None", | ||
| "request": { | ||
| "domainName": "None", | ||
| "headers": { | ||
| "accept": "*/*", | ||
| "accept-encoding": "gzip, deflate, br, zstd", | ||
| "accept-language": "en-US,en;q=0.9", | ||
| "cloudfront-forwarded-proto": "https", | ||
| "cloudfront-is-desktop-viewer": "True", | ||
| "cloudfront-is-mobile-viewer": "False", | ||
| "cloudfront-is-smarttv-viewer":"False", | ||
| "cloudfront-is-tablet-viewer":" False", | ||
| "cloudfront-viewer-asn": "6461", | ||
| "cloudfront-viewer-country": "US", | ||
| "content-length": "47", | ||
| "content-type": "application/graphql", | ||
| "host": "4aowrg2uhvbw5mn7osu6searqi.appsync-api.us-east-1.amazonaws.com", | ||
| "origin": "http://localhost:5173", | ||
| "priority": "u=1, i", | ||
| "referer": "http://localhost:5173/", | ||
| "sec-ch-ua": "\"Chromium\";v=\"140\", \"Not=A?Brand\";v=\"24\", \"Google Chrome\";v=\"140\"", | ||
| "sec-ch-ua-mobile": "?0", | ||
| "sec-ch-ua-platform": "macOS", | ||
| "sec-fetch-dest": "empty", | ||
| "sec-fetch-mode": "cors", | ||
| "sec-fetch-site": "cross-site", | ||
| "traceparent": "00-0000000000000000d9f454c80b9a529a-73ac6ca3427073a3-01", | ||
| "tracestate": "dd=s:1;o:rum", | ||
| "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)", | ||
| "x-amz-cf-id": "Femhicb_Vbva-J8qWjdI4hKMmqusCeQSp207UGyY3u8VOUrdE8BBvg==", | ||
| "x-amzn-appsync-is-vpce-request": "False", | ||
| "x-amzn-remote-ip": "64.124.12.19", | ||
| "x-amzn-requestid": "1ee1669a-eda3-4d4f-911c-35f74ebef31d", | ||
| "x-amzn-trace-id": "Root=1-68cdb7e9-438bf88259d7ce3535723bdd", | ||
| "x-datadog-origin": "rum", | ||
| "x-datadog-parent-id": "67890", | ||
| "x-datadog-sampling-priority": "1", | ||
| "x-datadog-trace-id": "12345", | ||
| "x-forwarded-for": "64.124.12.19,15.158.225.229", | ||
| "x-forwarded-port": "443", | ||
| "x-forwarded-proto": "https" | ||
| } | ||
| }, | ||
| "source": "None" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -179,6 +179,14 @@ def _wrap(*args, **kwargs): | |
| ), | ||
| ), | ||
| ("lambda-url", None), | ||
| ( | ||
| "rum-appsync", | ||
| Context( | ||
| trace_id=12345, | ||
| span_id=67890, | ||
| sampling_priority=1, | ||
| ) | ||
| ), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a lot more testing that we're going to need. When thinking about test coverage, I think about two things.
We also would need a test that makes sure that the authorizer context is never decoded. |
||
| ("s3", None), | ||
| ( | ||
| "sns-b64-msg-attribute", | ||
|
|
@@ -526,6 +534,77 @@ def test_with_sqs_distributed_w3c_trace_data(self): | |
| } | ||
| self.common_tests_with_trace_context_extraction_injection(headers, sqs_event) | ||
|
|
||
| @with_trace_propagation_style("datadog") | ||
| def test_with_request_header_datadog_trace_data(self): | ||
| """Test trace data extraction from event['request']['headers']""" | ||
| headers = { | ||
| TraceHeader.TRACE_ID: "12345", | ||
| TraceHeader.PARENT_ID: "67890", | ||
| TraceHeader.SAMPLING_PRIORITY: "1", | ||
| } | ||
| request_headers = { | ||
| "request": { | ||
| "domainName": "None", | ||
| "headers": { | ||
| "content-length": "47", | ||
| "content-type": "application/graphql", | ||
| "host": "4aowrg2uhvbw5mn7osu6searqi.appsync-api.us-east-1.amazonaws.com", | ||
| "origin": "http://localhost:5173", | ||
| "priority": "u=1, i", | ||
| "referer": "http://localhost:5173/", | ||
| "traceparent": "00-0000000000000000d9f454c80b9a529a-73ac6ca3427073a3-01", | ||
| "tracestate": "dd=s:1;o:rum", | ||
| "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)", | ||
| "x-amz-cf-id": "Femhicb_Vbva-J8qWjdI4hKMmqusCeQSp207UGyY3u8VOUrdE8BBvg==", | ||
| "x-amzn-appsync-is-vpce-request": "False", | ||
| "x-amzn-remote-ip": "64.124.12.19", | ||
| "x-amzn-requestid": "1ee1669a-eda3-4d4f-911c-35f74ebef31d", | ||
| "x-amzn-trace-id": "Root=1-68cdb7e9-438bf88259d7ce3535723bdd", | ||
| "x-datadog-parent-id": "67890", | ||
| "x-datadog-sampling-priority": "1", | ||
| "x-datadog-trace-id": "12345", | ||
| "x-forwarded-for": "64.124.12.19,15.158.225.229", | ||
| "x-forwarded-port": "443", | ||
| "x-forwarded-proto": "https" | ||
| } | ||
| }, | ||
| } | ||
| self.common_tests_with_trace_context_extraction_injection(headers, request_headers) | ||
|
|
||
| @with_trace_propagation_style("tracecontext") | ||
| def test_with_request_header_w3_trace_data(self): | ||
| """Test trace data extraction from event['request']['headers']""" | ||
| headers = { | ||
| "traceparent": "00-0000000000000000d9f454c80b9a529a-73ac6ca3427073a3-01", | ||
| "tracestate": "dd=s:1;o:rum", | ||
| } | ||
| request_headers = { | ||
| "request": { | ||
| "domainName": "None", | ||
| "headers": { | ||
| "content-length": "47", | ||
| "content-type": "application/graphql", | ||
| "host": "4aowrg2uhvbw5mn7osu6searqi.appsync-api.us-east-1.amazonaws.com", | ||
| "origin": "http://localhost:5173", | ||
| "priority": "u=1, i", | ||
| "referer": "http://localhost:5173/", | ||
| "traceparent": "00-0000000000000000d9f454c80b9a529a-73ac6ca3427073a3-01", | ||
| "tracestate": "dd=s:1;o:rum", | ||
| "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)", | ||
| "x-amz-cf-id": "Femhicb_Vbva-J8qWjdI4hKMmqusCeQSp207UGyY3u8VOUrdE8BBvg==", | ||
| "x-amzn-appsync-is-vpce-request": "False", | ||
| "x-amzn-remote-ip": "64.124.12.19", | ||
| "x-amzn-requestid": "1ee1669a-eda3-4d4f-911c-35f74ebef31d", | ||
| "x-amzn-trace-id": "Root=1-68cdb7e9-438bf88259d7ce3535723bdd", | ||
| "x-forwarded-for": "64.124.12.19,15.158.225.229", | ||
| "x-forwarded-port": "443", | ||
| "x-forwarded-proto": "https" | ||
| } | ||
| }, | ||
| } | ||
| self.common_tests_with_trace_context_extraction_injection(headers, request_headers) | ||
|
|
||
|
|
||
| @with_trace_propagation_style("datadog") | ||
| def test_with_legacy_client_context_datadog_trace_data(self): | ||
| headers = { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.