forked from open-telemetry/opentelemetry-python-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into bump-grpcio-1-test-requirements
- Loading branch information
Showing
13 changed files
with
467 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...on/opentelemetry-instrumentation-aws-lambda/tests/mocks/alb_conventional_headers_event.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
MOCK_LAMBDA_ALB_EVENT = { | ||
"requestContext": { | ||
"elb": { | ||
"targetGroupArn": "arn:aws:elasticloadbalancing:region:123456789012:targetgroup/my-target-group/6d0ecf831eec9f09" | ||
} | ||
}, | ||
"httpMethod": "GET", | ||
"path": "/", | ||
"queryStringParameters": {"foo": "bar"}, | ||
"headers": { | ||
"accept": "text/html,application/xhtml+xml", | ||
"accept-language": "en-US,en;q=0.8", | ||
"content-type": "text/plain", | ||
"cookie": "cookies", | ||
"host": "lambda-846800462-us-east-2.elb.amazonaws.com", | ||
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6)", | ||
"x-amzn-trace-id": "Root=1-5bdb40ca-556d8b0c50dc66f0511bf520", | ||
"x-forwarded-for": "72.21.198.66", | ||
"x-forwarded-port": "443", | ||
"x-forwarded-proto": "https", | ||
}, | ||
"isBase64Encoded": False, | ||
"body": "request_body", | ||
} |
30 changes: 30 additions & 0 deletions
30
...ion/opentelemetry-instrumentation-aws-lambda/tests/mocks/alb_multi_value_headers_event.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html#multi-value-headers | ||
When an ALB is configured to send multi-value headers, the headers are sent as a list of values under the key in the multiValueHeaders object. | ||
""" | ||
|
||
MOCK_LAMBDA_ALB_MULTI_VALUE_HEADER_EVENT = { | ||
"requestContext": { | ||
"elb": { | ||
"targetGroupArn": "arn:aws:elasticloadbalancing:region:123456789012:targetgroup/my-target-group/6d0ecf831eec9f09" | ||
} | ||
}, | ||
"httpMethod": "GET", | ||
"path": "/", | ||
"queryStringParameters": {"foo": "bar"}, | ||
"multiValueHeaders": { | ||
"accept": ["text/html,application/xhtml+xml"], | ||
"accept-language": ["en-US,en;q=0.8"], | ||
"content-type": ["text/plain"], | ||
"cookie": ["cookies"], | ||
"host": ["lambda-846800462-us-east-2.elb.amazonaws.com"], | ||
"user-agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6)"], | ||
"x-amzn-trace-id": ["Root=1-5bdb40ca-556d8b0c50dc66f0511bf520"], | ||
"x-forwarded-for": ["72.21.198.66"], | ||
"x-forwarded-port": ["443"], | ||
"x-forwarded-proto": ["https"], | ||
}, | ||
"isBase64Encoded": False, | ||
"body": "request_body", | ||
} |
48 changes: 48 additions & 0 deletions
48
instrumentation/opentelemetry-instrumentation-aws-lambda/tests/mocks/dynamo_db_event.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
""" | ||
https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html | ||
""" | ||
|
||
MOCK_LAMBDA_DYNAMO_DB_EVENT = { | ||
"Records": [ | ||
{ | ||
"eventID": "1", | ||
"eventVersion": "1.0", | ||
"dynamodb": { | ||
"Keys": {"Id": {"N": "101"}}, | ||
"NewImage": { | ||
"Message": {"S": "New item!"}, | ||
"Id": {"N": "101"}, | ||
}, | ||
"StreamViewType": "NEW_AND_OLD_IMAGES", | ||
"SequenceNumber": "111", | ||
"SizeBytes": 26, | ||
}, | ||
"awsRegion": "us-west-2", | ||
"eventName": "INSERT", | ||
"eventSourceARN": "arn:aws:dynamodb:us-east-2:123456789012:table/my-table/stream/2023-06-10T19:26:16.525", | ||
"eventSource": "aws:dynamodb", | ||
}, | ||
{ | ||
"eventID": "2", | ||
"eventVersion": "1.0", | ||
"dynamodb": { | ||
"OldImage": { | ||
"Message": {"S": "New item!"}, | ||
"Id": {"N": "101"}, | ||
}, | ||
"SequenceNumber": "222", | ||
"Keys": {"Id": {"N": "101"}}, | ||
"SizeBytes": 59, | ||
"NewImage": { | ||
"Message": {"S": "This item has changed"}, | ||
"Id": {"N": "101"}, | ||
}, | ||
"StreamViewType": "NEW_AND_OLD_IMAGES", | ||
}, | ||
"awsRegion": "us-west-2", | ||
"eventName": "MODIFY", | ||
"eventSourceARN": "arn:aws:dynamodb:us-east-2:123456789012:table/my-table/stream/2023-06-10T19:26:16.525", | ||
"eventSource": "aws:dynamodb", | ||
}, | ||
] | ||
} |
36 changes: 36 additions & 0 deletions
36
instrumentation/opentelemetry-instrumentation-aws-lambda/tests/mocks/s3_event.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
""" | ||
https://docs.aws.amazon.com/lambda/latest/dg/with-s3.html | ||
""" | ||
|
||
MOCK_LAMBDA_S3_EVENT = { | ||
"Records": [ | ||
{ | ||
"eventVersion": "2.1", | ||
"eventSource": "aws:s3", | ||
"awsRegion": "us-east-2", | ||
"eventTime": "2019-09-03T19:37:27.192Z", | ||
"eventName": "ObjectCreated:Put", | ||
"userIdentity": {"principalId": "AWS:AIDAINPONIXQXHT3IKHL2"}, | ||
"requestParameters": {"sourceIPAddress": "205.255.255.255"}, | ||
"responseElements": { | ||
"x-amz-request-id": "D82B88E5F771F645", | ||
"x-amz-id-2": "vlR7PnpV2Ce81l0PRw6jlUpck7Jo5ZsQjryTjKlc5aLWGVHPZLj5NeC6qMa0emYBDXOo6QBU0Wo=", | ||
}, | ||
"s3": { | ||
"s3SchemaVersion": "1.0", | ||
"configurationId": "828aa6fc-f7b5-4305-8584-487c791949c1", | ||
"bucket": { | ||
"name": "DOC-EXAMPLE-BUCKET", | ||
"ownerIdentity": {"principalId": "A3I5XTEXAMAI3E"}, | ||
"arn": "arn:aws:s3:::lambda-artifacts-deafc19498e3f2df", | ||
}, | ||
"object": { | ||
"key": "b21b84d653bb07b05b1e6b33684dc11b", | ||
"size": 1305107, | ||
"eTag": "b21b84d653bb07b05b1e6b33684dc11b", | ||
"sequencer": "0C0F6F405D6ED209E1", | ||
}, | ||
}, | ||
} | ||
] | ||
} |
29 changes: 29 additions & 0 deletions
29
instrumentation/opentelemetry-instrumentation-aws-lambda/tests/mocks/sns_event.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
""" | ||
https://docs.aws.amazon.com/lambda/latest/dg/with-sns.html | ||
""" | ||
|
||
MOCK_LAMBDA_SNS_EVENT = { | ||
"Records": [ | ||
{ | ||
"EventVersion": "1.0", | ||
"EventSubscriptionArn": "arn:aws:sns:us-east-1:123456789012:sns-lambda:21be56ed-a058-49f5-8c98-aedd2564c486", | ||
"EventSource": "aws:sns", | ||
"Sns": { | ||
"SignatureVersion": "1", | ||
"Timestamp": "2019-01-02T12:45:07.000Z", | ||
"Signature": "mock-signature", | ||
"SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-ac565b8b1a6c5d002d285f9598aa1d9b.pem", | ||
"MessageId": "95df01b4-ee98-5cb9-9903-4c221d41eb5e", | ||
"Message": "Hello from SNS!", | ||
"MessageAttributes": { | ||
"Test": {"Type": "String", "Value": "TestString"}, | ||
"TestBinary": {"Type": "Binary", "Value": "TestBinary"}, | ||
}, | ||
"Type": "Notification", | ||
"UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:123456789012:test-lambda:21be56ed-a058-49f5-8c98-aedd2564c486", | ||
"TopicArn": "arn:aws:sns:us-east-1:123456789012:sns-lambda", | ||
"Subject": "TestInvoke", | ||
}, | ||
} | ||
] | ||
} |
24 changes: 24 additions & 0 deletions
24
instrumentation/opentelemetry-instrumentation-aws-lambda/tests/mocks/sqs_event.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html | ||
""" | ||
|
||
MOCK_LAMBDA_SQS_EVENT = { | ||
"Records": [ | ||
{ | ||
"messageId": "059f36b4-87a3-44ab-83d2-661975830a7d", | ||
"receiptHandle": "AQEBwJnKyrHigUMZj6rYigCgxlaS3SLy0a...", | ||
"body": "Test message.", | ||
"attributes": { | ||
"ApproximateReceiveCount": "1", | ||
"SentTimestamp": "1545082649183", | ||
"SenderId": "AIDAIENQZJOLO23YVJ4VO", | ||
"ApproximateFirstReceiveTimestamp": "1545082649185", | ||
}, | ||
"messageAttributes": {}, | ||
"md5OfBody": "e4e68fb7bd0e697a0ae8f1bb342846b3", | ||
"eventSource": "aws:sqs", | ||
"eventSourceARN": "arn:aws:sqs:us-east-2:123456789012:my-queue", | ||
"awsRegion": "us-east-2", | ||
} | ||
] | ||
} |
Oops, something went wrong.