From 34f27a945b5a8d9e16e46a041d79853a778d1531 Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Mon, 24 Feb 2020 14:19:11 -0500 Subject: [PATCH 01/19] Add first integration test function --- .../cloudformation-template-create-stack.json | 27 ++ .../cloudformation-template-update-stack.json | 315 ++++++++++++++ .../.serverless/integration-tester.zip | Bin 0 -> 288 bytes .../.serverless/serverless-state.json | 398 ++++++++++++++++++ tests/integration/handler.py | 10 + tests/integration/serverless.yml | 20 + 6 files changed, 770 insertions(+) create mode 100644 tests/integration/.serverless/cloudformation-template-create-stack.json create mode 100644 tests/integration/.serverless/cloudformation-template-update-stack.json create mode 100644 tests/integration/.serverless/integration-tester.zip create mode 100644 tests/integration/.serverless/serverless-state.json create mode 100644 tests/integration/handler.py create mode 100644 tests/integration/serverless.yml diff --git a/tests/integration/.serverless/cloudformation-template-create-stack.json b/tests/integration/.serverless/cloudformation-template-create-stack.json new file mode 100644 index 00000000..3ea21a30 --- /dev/null +++ b/tests/integration/.serverless/cloudformation-template-create-stack.json @@ -0,0 +1,27 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "The AWS CloudFormation template for this Serverless application", + "Resources": { + "ServerlessDeploymentBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + } + } + }, + "Outputs": { + "ServerlessDeploymentBucketName": { + "Value": { + "Ref": "ServerlessDeploymentBucket" + } + } + } +} \ No newline at end of file diff --git a/tests/integration/.serverless/cloudformation-template-update-stack.json b/tests/integration/.serverless/cloudformation-template-update-stack.json new file mode 100644 index 00000000..abf31dd2 --- /dev/null +++ b/tests/integration/.serverless/cloudformation-template-update-stack.json @@ -0,0 +1,315 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "The AWS CloudFormation template for this Serverless application", + "Resources": { + "ServerlessDeploymentBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + } + }, + "CustomDashmetricDashwriterDashpython27LogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/integration-tester-dev-custom-metric-writer-python27" + } + }, + "IamRoleLambdaExecution": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + }, + "Policies": [ + { + "PolicyName": { + "Fn::Join": [ + "-", + [ + "dev", + "integration-tester", + "lambda" + ] + ] + }, + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogStream" + ], + "Resource": [ + { + "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/integration-tester-dev*:*" + } + ] + }, + { + "Effect": "Allow", + "Action": [ + "logs:PutLogEvents" + ], + "Resource": [ + { + "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/integration-tester-dev*:*:*" + } + ] + } + ] + } + } + ], + "Path": "/", + "RoleName": { + "Fn::Join": [ + "-", + [ + "integration-tester", + "dev", + { + "Ref": "AWS::Region" + }, + "lambdaRole" + ] + ] + } + } + }, + "TestLambdaLayer": { + "Type": "AWS::Lambda::LayerVersion", + "Properties": { + "Content": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/integration-tester/dev/1582571794655-2020-02-24T19:16:34.655Z/datadog_lambda_py2.7.zip" + }, + "LayerName": "test" + } + }, + "CustomDashmetricDashwriterDashpython27LambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/integration-tester/dev/1582571794655-2020-02-24T19:16:34.655Z/integration-tester.zip" + }, + "FunctionName": "integration-tester-dev-custom-metric-writer-python27", + "Handler": "handler.handle", + "MemorySize": 1024, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + }, + "Runtime": "python2.7", + "Timeout": 6, + "Layers": [ + { + "Ref": "TestLambdaLayer" + } + ] + }, + "DependsOn": [ + "CustomDashmetricDashwriterDashpython27LogGroup", + "IamRoleLambdaExecution" + ] + }, + "CustomDashmetricDashwriterDashpython27LambdaVersion8Uuw4UZraNHeUFMZ6gOKWETimHZStyXU1J9Csl1Rrxo": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "CustomDashmetricDashwriterDashpython27LambdaFunction" + }, + "CodeSha256": "hN8ew3WnFE5Y5SjxBqvugAkr9bLFz+oiWqGPMUqUkV4=" + } + }, + "ApiGatewayRestApi": { + "Type": "AWS::ApiGateway::RestApi", + "Properties": { + "Name": "dev-integration-tester", + "EndpointConfiguration": { + "Types": [ + "EDGE" + ] + } + } + }, + "ApiGatewayResourceHello": { + "Type": "AWS::ApiGateway::Resource", + "Properties": { + "ParentId": { + "Fn::GetAtt": [ + "ApiGatewayRestApi", + "RootResourceId" + ] + }, + "PathPart": "hello", + "RestApiId": { + "Ref": "ApiGatewayRestApi" + } + } + }, + "ApiGatewayMethodHelloGet": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "GET", + "RequestParameters": {}, + "ResourceId": { + "Ref": "ApiGatewayResourceHello" + }, + "RestApiId": { + "Ref": "ApiGatewayRestApi" + }, + "ApiKeyRequired": false, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationHttpMethod": "POST", + "Type": "AWS_PROXY", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:", + { + "Ref": "AWS::Region" + }, + ":lambda:path/2015-03-31/functions/", + { + "Fn::GetAtt": [ + "CustomDashmetricDashwriterDashpython27LambdaFunction", + "Arn" + ] + }, + "/invocations" + ] + ] + } + }, + "MethodResponses": [] + } + }, + "ApiGatewayDeployment1582571794121": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ApiGatewayRestApi" + }, + "StageName": "dev" + }, + "DependsOn": [ + "ApiGatewayMethodHelloGet" + ] + }, + "CustomDashmetricDashwriterDashpython27LambdaPermissionApiGateway": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "FunctionName": { + "Fn::GetAtt": [ + "CustomDashmetricDashwriterDashpython27LambdaFunction", + "Arn" + ] + }, + "Action": "lambda:InvokeFunction", + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "ApiGatewayRestApi" + }, + "/*/*" + ] + ] + } + } + } + }, + "Outputs": { + "ServerlessDeploymentBucketName": { + "Value": { + "Ref": "ServerlessDeploymentBucket" + } + }, + "TestLambdaLayerQualifiedArn": { + "Description": "Current Lambda layer version", + "Value": { + "Ref": "TestLambdaLayer" + } + }, + "CustomDashmetricDashwriterDashpython27LambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "CustomDashmetricDashwriterDashpython27LambdaVersion8Uuw4UZraNHeUFMZ6gOKWETimHZStyXU1J9Csl1Rrxo" + } + }, + "ServiceEndpoint": { + "Description": "URL of the service endpoint", + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "ApiGatewayRestApi" + }, + ".execute-api.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/dev" + ] + ] + } + } + } +} \ No newline at end of file diff --git a/tests/integration/.serverless/integration-tester.zip b/tests/integration/.serverless/integration-tester.zip new file mode 100644 index 0000000000000000000000000000000000000000..153e2242882c33d5aedc80a88e084c00a98948cb GIT binary patch literal 288 zcmWIWW@Zs#-~d7f21Ou704^XiBQY-}C$&hgpt7{@EY~3eftL4`U8c*$oL0(J3)M{6 zl)G))q!jO6U)ew2<#pq4dY7BFFEZ_uv3uj?LyjvIH?em&P3vFld_QuHjpv-I8Aj93 zn$5QV>3yVf*$>T{`t18FgR=gsZ!|g3anMTZg^wf87nzoIL1tW+YIQZfc$_Po`Ynt3 z_9s`DNv3Q&Ub_ZddwO763G?n+mY~i?c0bfHyk_*Y&#xX93;I%E-VF p;LXUS%Z%_7vK+`y5TL-Yq!GkI_%Ohml?^1q2!s|u`Vxr4004o>UvK~b literal 0 HcmV?d00001 diff --git a/tests/integration/.serverless/serverless-state.json b/tests/integration/.serverless/serverless-state.json new file mode 100644 index 00000000..33582297 --- /dev/null +++ b/tests/integration/.serverless/serverless-state.json @@ -0,0 +1,398 @@ +{ + "service": { + "service": "integration-tester", + "serviceObject": { + "name": "integration-tester" + }, + "provider": { + "stage": "dev", + "variableSyntax": "\\${([ ~:a-zA-Z0-9._@'\",\\-\\/\\(\\)*]+?)}", + "name": "aws", + "region": "us-east-1", + "versionFunctions": true, + "remoteFunctionData": null, + "compiledCloudFormationTemplate": { + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "The AWS CloudFormation template for this Serverless application", + "Resources": { + "ServerlessDeploymentBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + } + }, + "CustomDashmetricDashwriterDashpython27LogGroup": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": "/aws/lambda/integration-tester-dev-custom-metric-writer-python27" + } + }, + "IamRoleLambdaExecution": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + }, + "Policies": [ + { + "PolicyName": { + "Fn::Join": [ + "-", + [ + "dev", + "integration-tester", + "lambda" + ] + ] + }, + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogStream" + ], + "Resource": [ + { + "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/integration-tester-dev*:*" + } + ] + }, + { + "Effect": "Allow", + "Action": [ + "logs:PutLogEvents" + ], + "Resource": [ + { + "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/integration-tester-dev*:*:*" + } + ] + } + ] + } + } + ], + "Path": "/", + "RoleName": { + "Fn::Join": [ + "-", + [ + "integration-tester", + "dev", + { + "Ref": "AWS::Region" + }, + "lambdaRole" + ] + ] + } + } + }, + "TestLambdaLayer": { + "Type": "AWS::Lambda::LayerVersion", + "Properties": { + "Content": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/integration-tester/dev/1582571794655-2020-02-24T19:16:34.655Z/datadog_lambda_py2.7.zip" + }, + "LayerName": "test" + } + }, + "CustomDashmetricDashwriterDashpython27LambdaFunction": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "ServerlessDeploymentBucket" + }, + "S3Key": "serverless/integration-tester/dev/1582571794655-2020-02-24T19:16:34.655Z/integration-tester.zip" + }, + "FunctionName": "integration-tester-dev-custom-metric-writer-python27", + "Handler": "handler.handle", + "MemorySize": 1024, + "Role": { + "Fn::GetAtt": [ + "IamRoleLambdaExecution", + "Arn" + ] + }, + "Runtime": "python2.7", + "Timeout": 6, + "Layers": [ + { + "Ref": "TestLambdaLayer" + } + ] + }, + "DependsOn": [ + "CustomDashmetricDashwriterDashpython27LogGroup", + "IamRoleLambdaExecution" + ] + }, + "CustomDashmetricDashwriterDashpython27LambdaVersion8Uuw4UZraNHeUFMZ6gOKWETimHZStyXU1J9Csl1Rrxo": { + "Type": "AWS::Lambda::Version", + "DeletionPolicy": "Retain", + "Properties": { + "FunctionName": { + "Ref": "CustomDashmetricDashwriterDashpython27LambdaFunction" + }, + "CodeSha256": "hN8ew3WnFE5Y5SjxBqvugAkr9bLFz+oiWqGPMUqUkV4=" + } + }, + "ApiGatewayRestApi": { + "Type": "AWS::ApiGateway::RestApi", + "Properties": { + "Name": "dev-integration-tester", + "EndpointConfiguration": { + "Types": [ + "EDGE" + ] + } + } + }, + "ApiGatewayResourceHello": { + "Type": "AWS::ApiGateway::Resource", + "Properties": { + "ParentId": { + "Fn::GetAtt": [ + "ApiGatewayRestApi", + "RootResourceId" + ] + }, + "PathPart": "hello", + "RestApiId": { + "Ref": "ApiGatewayRestApi" + } + } + }, + "ApiGatewayMethodHelloGet": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "GET", + "RequestParameters": {}, + "ResourceId": { + "Ref": "ApiGatewayResourceHello" + }, + "RestApiId": { + "Ref": "ApiGatewayRestApi" + }, + "ApiKeyRequired": false, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationHttpMethod": "POST", + "Type": "AWS_PROXY", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:", + { + "Ref": "AWS::Region" + }, + ":lambda:path/2015-03-31/functions/", + { + "Fn::GetAtt": [ + "CustomDashmetricDashwriterDashpython27LambdaFunction", + "Arn" + ] + }, + "/invocations" + ] + ] + } + }, + "MethodResponses": [] + } + }, + "ApiGatewayDeployment1582571794121": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "ApiGatewayRestApi" + }, + "StageName": "dev" + }, + "DependsOn": [ + "ApiGatewayMethodHelloGet" + ] + }, + "CustomDashmetricDashwriterDashpython27LambdaPermissionApiGateway": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "FunctionName": { + "Fn::GetAtt": [ + "CustomDashmetricDashwriterDashpython27LambdaFunction", + "Arn" + ] + }, + "Action": "lambda:InvokeFunction", + "Principal": "apigateway.amazonaws.com", + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":execute-api:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":", + { + "Ref": "ApiGatewayRestApi" + }, + "/*/*" + ] + ] + } + } + } + }, + "Outputs": { + "ServerlessDeploymentBucketName": { + "Value": { + "Ref": "ServerlessDeploymentBucket" + } + }, + "TestLambdaLayerQualifiedArn": { + "Description": "Current Lambda layer version", + "Value": { + "Ref": "TestLambdaLayer" + } + }, + "CustomDashmetricDashwriterDashpython27LambdaFunctionQualifiedArn": { + "Description": "Current Lambda function version", + "Value": { + "Ref": "CustomDashmetricDashwriterDashpython27LambdaVersion8Uuw4UZraNHeUFMZ6gOKWETimHZStyXU1J9Csl1Rrxo" + } + }, + "ServiceEndpoint": { + "Description": "URL of the service endpoint", + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "ApiGatewayRestApi" + }, + ".execute-api.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/dev" + ] + ] + } + } + } + }, + "coreCloudFormationTemplate": { + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "The AWS CloudFormation template for this Serverless application", + "Resources": { + "ServerlessDeploymentBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + } + } + }, + "Outputs": { + "ServerlessDeploymentBucketName": { + "Value": { + "Ref": "ServerlessDeploymentBucket" + } + } + } + }, + "vpc": {} + }, + "pluginsData": {}, + "functions": { + "custom-metric-writer-python27": { + "handler": "handler.handle", + "runtime": "python2.7", + "events": [ + { + "http": { + "method": "get", + "path": "hello", + "integration": "AWS_PROXY" + } + } + ], + "layers": [ + { + "Ref": "TestLambdaLayer" + } + ], + "name": "integration-tester-dev-custom-metric-writer-python27", + "package": {}, + "memory": 1024, + "timeout": 6, + "vpc": {} + } + }, + "serviceFilename": "serverless.yml", + "layers": { + "test": { + "package": { + "artifact": "../../.layers/datadog_lambda_py2.7.zip" + } + } + }, + "artifact": "/Users/stephenfirrincieli/go/src/github.com/DataDog/datadog-lambda-layer-python/tests/integration/.serverless/integration-tester.zip" + }, + "package": { + "artifactDirectoryName": "serverless/integration-tester/dev/1582571794655-2020-02-24T19:16:34.655Z", + "artifact": "integration-tester.zip" + } +} \ No newline at end of file diff --git a/tests/integration/handler.py b/tests/integration/handler.py new file mode 100644 index 00000000..782f9d10 --- /dev/null +++ b/tests/integration/handler.py @@ -0,0 +1,10 @@ +import json + +from datadog_lambda.metric import lambda_metric +from datadog_lambda.wrapper import datadog_lambda_wrapper + + +@datadog_lambda_wrapper +def handle(event, context): + lambda_metric("hello.dog", 1) + return {"statusCode": 200, "body": "hello, dog!"} diff --git a/tests/integration/serverless.yml b/tests/integration/serverless.yml new file mode 100644 index 00000000..5067c84e --- /dev/null +++ b/tests/integration/serverless.yml @@ -0,0 +1,20 @@ +service: integration-tester + +provider: + name: aws + +layers: + test: + package: + artifact: ../../.layers/datadog_lambda_py2.7.zip + +functions: + custom-metric-writer-python27: + handler: handler.handle + runtime: python2.7 + events: + - http: + method: get + path: /hello + layers: + - { Ref: TestLambdaLayer } # Refers to the local lambda created above From 840f7cdd70a36e89a4511d798739e2e1b9d69f34 Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Tue, 25 Feb 2020 18:19:13 -0500 Subject: [PATCH 02/19] Deploy, invoke, fetch logs, and compare to snapshot --- .gitignore | 3 + scripts/run_integration_tests.sh | 52 +++ .../cloudformation-template-create-stack.json | 27 -- .../cloudformation-template-update-stack.json | 315 -------------- .../.serverless/integration-tester.zip | Bin 288 -> 0 bytes .../.serverless/serverless-state.json | 398 ------------------ tests/integration/compare_to_snapshots.py | 186 ++++++++ tests/integration/serverless.yml | 50 ++- .../snapshots/async-metrics-python27.snapshot | 7 + .../snapshots/async-metrics-python36.snapshot | 7 + .../snapshots/async-metrics-python37.snapshot | 7 + .../snapshots/async-metrics-python38.snapshot | 7 + .../{handler.py => submit_metrics.py} | 5 +- 13 files changed, 315 insertions(+), 749 deletions(-) create mode 100755 scripts/run_integration_tests.sh delete mode 100644 tests/integration/.serverless/cloudformation-template-create-stack.json delete mode 100644 tests/integration/.serverless/cloudformation-template-update-stack.json delete mode 100644 tests/integration/.serverless/integration-tester.zip delete mode 100644 tests/integration/.serverless/serverless-state.json create mode 100644 tests/integration/compare_to_snapshots.py create mode 100644 tests/integration/snapshots/async-metrics-python27.snapshot create mode 100644 tests/integration/snapshots/async-metrics-python36.snapshot create mode 100644 tests/integration/snapshots/async-metrics-python37.snapshot create mode 100644 tests/integration/snapshots/async-metrics-python38.snapshot rename tests/integration/{handler.py => submit_metrics.py} (56%) diff --git a/.gitignore b/.gitignore index c001eee2..50801e5e 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,6 @@ nosetests.xml .eggs/ .env/ .idea/ + + +**/.serverless/ \ No newline at end of file diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh new file mode 100755 index 00000000..b45be456 --- /dev/null +++ b/scripts/run_integration_tests.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +set -e + +# These values need to be in sync with serverless.yml, where there needs to be a function +# defined for every handler-runtime combination +LAMBDA_HANDLERS=("async-metrics") +RUNTIMES=("python27" "python36" "python37" "python38") + +LOGS_WAIT_SECONDS=20 + +script_path=${BASH_SOURCE[0]} +scripts_dir=$(dirname $script_path) +repo_dir=$(dirname $scripts_dir) +integration_tests_dir="$repo_dir/tests/integration" + +script_start_time=$(date --iso-8601=seconds) + +echo "Start time is $script_start_time" + +echo "Building new layers that will be uploaded with our test functions" +# source $scripts_dir/build_layers.sh + +echo "Deploying functions" +cd $integration_tests_dir +serverless deploy + +echo "Invoking functions" +for handler_name in "${LAMBDA_HANDLERS[@]}"; do + for runtime in "${RUNTIMES[@]}"; do + echo "Invoking $handler_name-$runtime" + serverless invoke -f "$handler_name-$runtime" + done +done + +echo "Sleeping for $LOGS_WAIT_SECONDS seconds to wait for logs to appear in CloudWatch..." +sleep $LOGS_WAIT_SECONDS + +echo "Fetching logs for invocations and comparing to snapshots" +for handler_name in "${LAMBDA_HANDLERS[@]}"; do + for runtime in "${RUNTIMES[@]}"; do + logs=$(serverless logs -f "$handler_name-$runtime" --startTime $script_start_time) + python compare_to_snapshots.py "$handler_name-$runtime" "$logs" + done +done + +# Go back to the repo root +cd $repo_dir + +# Download the new CloudWatch logs for each Lambda + +# Filter out all logs that aren't metrics and traces and compare to the snapshots in this repo diff --git a/tests/integration/.serverless/cloudformation-template-create-stack.json b/tests/integration/.serverless/cloudformation-template-create-stack.json deleted file mode 100644 index 3ea21a30..00000000 --- a/tests/integration/.serverless/cloudformation-template-create-stack.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "AWSTemplateFormatVersion": "2010-09-09", - "Description": "The AWS CloudFormation template for this Serverless application", - "Resources": { - "ServerlessDeploymentBucket": { - "Type": "AWS::S3::Bucket", - "Properties": { - "BucketEncryption": { - "ServerSideEncryptionConfiguration": [ - { - "ServerSideEncryptionByDefault": { - "SSEAlgorithm": "AES256" - } - } - ] - } - } - } - }, - "Outputs": { - "ServerlessDeploymentBucketName": { - "Value": { - "Ref": "ServerlessDeploymentBucket" - } - } - } -} \ No newline at end of file diff --git a/tests/integration/.serverless/cloudformation-template-update-stack.json b/tests/integration/.serverless/cloudformation-template-update-stack.json deleted file mode 100644 index abf31dd2..00000000 --- a/tests/integration/.serverless/cloudformation-template-update-stack.json +++ /dev/null @@ -1,315 +0,0 @@ -{ - "AWSTemplateFormatVersion": "2010-09-09", - "Description": "The AWS CloudFormation template for this Serverless application", - "Resources": { - "ServerlessDeploymentBucket": { - "Type": "AWS::S3::Bucket", - "Properties": { - "BucketEncryption": { - "ServerSideEncryptionConfiguration": [ - { - "ServerSideEncryptionByDefault": { - "SSEAlgorithm": "AES256" - } - } - ] - } - } - }, - "CustomDashmetricDashwriterDashpython27LogGroup": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "/aws/lambda/integration-tester-dev-custom-metric-writer-python27" - } - }, - "IamRoleLambdaExecution": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "Service": [ - "lambda.amazonaws.com" - ] - }, - "Action": [ - "sts:AssumeRole" - ] - } - ] - }, - "Policies": [ - { - "PolicyName": { - "Fn::Join": [ - "-", - [ - "dev", - "integration-tester", - "lambda" - ] - ] - }, - "PolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "logs:CreateLogStream" - ], - "Resource": [ - { - "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/integration-tester-dev*:*" - } - ] - }, - { - "Effect": "Allow", - "Action": [ - "logs:PutLogEvents" - ], - "Resource": [ - { - "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/integration-tester-dev*:*:*" - } - ] - } - ] - } - } - ], - "Path": "/", - "RoleName": { - "Fn::Join": [ - "-", - [ - "integration-tester", - "dev", - { - "Ref": "AWS::Region" - }, - "lambdaRole" - ] - ] - } - } - }, - "TestLambdaLayer": { - "Type": "AWS::Lambda::LayerVersion", - "Properties": { - "Content": { - "S3Bucket": { - "Ref": "ServerlessDeploymentBucket" - }, - "S3Key": "serverless/integration-tester/dev/1582571794655-2020-02-24T19:16:34.655Z/datadog_lambda_py2.7.zip" - }, - "LayerName": "test" - } - }, - "CustomDashmetricDashwriterDashpython27LambdaFunction": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "ServerlessDeploymentBucket" - }, - "S3Key": "serverless/integration-tester/dev/1582571794655-2020-02-24T19:16:34.655Z/integration-tester.zip" - }, - "FunctionName": "integration-tester-dev-custom-metric-writer-python27", - "Handler": "handler.handle", - "MemorySize": 1024, - "Role": { - "Fn::GetAtt": [ - "IamRoleLambdaExecution", - "Arn" - ] - }, - "Runtime": "python2.7", - "Timeout": 6, - "Layers": [ - { - "Ref": "TestLambdaLayer" - } - ] - }, - "DependsOn": [ - "CustomDashmetricDashwriterDashpython27LogGroup", - "IamRoleLambdaExecution" - ] - }, - "CustomDashmetricDashwriterDashpython27LambdaVersion8Uuw4UZraNHeUFMZ6gOKWETimHZStyXU1J9Csl1Rrxo": { - "Type": "AWS::Lambda::Version", - "DeletionPolicy": "Retain", - "Properties": { - "FunctionName": { - "Ref": "CustomDashmetricDashwriterDashpython27LambdaFunction" - }, - "CodeSha256": "hN8ew3WnFE5Y5SjxBqvugAkr9bLFz+oiWqGPMUqUkV4=" - } - }, - "ApiGatewayRestApi": { - "Type": "AWS::ApiGateway::RestApi", - "Properties": { - "Name": "dev-integration-tester", - "EndpointConfiguration": { - "Types": [ - "EDGE" - ] - } - } - }, - "ApiGatewayResourceHello": { - "Type": "AWS::ApiGateway::Resource", - "Properties": { - "ParentId": { - "Fn::GetAtt": [ - "ApiGatewayRestApi", - "RootResourceId" - ] - }, - "PathPart": "hello", - "RestApiId": { - "Ref": "ApiGatewayRestApi" - } - } - }, - "ApiGatewayMethodHelloGet": { - "Type": "AWS::ApiGateway::Method", - "Properties": { - "HttpMethod": "GET", - "RequestParameters": {}, - "ResourceId": { - "Ref": "ApiGatewayResourceHello" - }, - "RestApiId": { - "Ref": "ApiGatewayRestApi" - }, - "ApiKeyRequired": false, - "AuthorizationType": "NONE", - "Integration": { - "IntegrationHttpMethod": "POST", - "Type": "AWS_PROXY", - "Uri": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":apigateway:", - { - "Ref": "AWS::Region" - }, - ":lambda:path/2015-03-31/functions/", - { - "Fn::GetAtt": [ - "CustomDashmetricDashwriterDashpython27LambdaFunction", - "Arn" - ] - }, - "/invocations" - ] - ] - } - }, - "MethodResponses": [] - } - }, - "ApiGatewayDeployment1582571794121": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ApiGatewayRestApi" - }, - "StageName": "dev" - }, - "DependsOn": [ - "ApiGatewayMethodHelloGet" - ] - }, - "CustomDashmetricDashwriterDashpython27LambdaPermissionApiGateway": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "FunctionName": { - "Fn::GetAtt": [ - "CustomDashmetricDashwriterDashpython27LambdaFunction", - "Arn" - ] - }, - "Action": "lambda:InvokeFunction", - "Principal": "apigateway.amazonaws.com", - "SourceArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":execute-api:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":", - { - "Ref": "ApiGatewayRestApi" - }, - "/*/*" - ] - ] - } - } - } - }, - "Outputs": { - "ServerlessDeploymentBucketName": { - "Value": { - "Ref": "ServerlessDeploymentBucket" - } - }, - "TestLambdaLayerQualifiedArn": { - "Description": "Current Lambda layer version", - "Value": { - "Ref": "TestLambdaLayer" - } - }, - "CustomDashmetricDashwriterDashpython27LambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "CustomDashmetricDashwriterDashpython27LambdaVersion8Uuw4UZraNHeUFMZ6gOKWETimHZStyXU1J9Csl1Rrxo" - } - }, - "ServiceEndpoint": { - "Description": "URL of the service endpoint", - "Value": { - "Fn::Join": [ - "", - [ - "https://", - { - "Ref": "ApiGatewayRestApi" - }, - ".execute-api.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/dev" - ] - ] - } - } - } -} \ No newline at end of file diff --git a/tests/integration/.serverless/integration-tester.zip b/tests/integration/.serverless/integration-tester.zip deleted file mode 100644 index 153e2242882c33d5aedc80a88e084c00a98948cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 288 zcmWIWW@Zs#-~d7f21Ou704^XiBQY-}C$&hgpt7{@EY~3eftL4`U8c*$oL0(J3)M{6 zl)G))q!jO6U)ew2<#pq4dY7BFFEZ_uv3uj?LyjvIH?em&P3vFld_QuHjpv-I8Aj93 zn$5QV>3yVf*$>T{`t18FgR=gsZ!|g3anMTZg^wf87nzoIL1tW+YIQZfc$_Po`Ynt3 z_9s`DNv3Q&Ub_ZddwO763G?n+mY~i?c0bfHyk_*Y&#xX93;I%E-VF p;LXUS%Z%_7vK+`y5TL-Yq!GkI_%Ohml?^1q2!s|u`Vxr4004o>UvK~b diff --git a/tests/integration/.serverless/serverless-state.json b/tests/integration/.serverless/serverless-state.json deleted file mode 100644 index 33582297..00000000 --- a/tests/integration/.serverless/serverless-state.json +++ /dev/null @@ -1,398 +0,0 @@ -{ - "service": { - "service": "integration-tester", - "serviceObject": { - "name": "integration-tester" - }, - "provider": { - "stage": "dev", - "variableSyntax": "\\${([ ~:a-zA-Z0-9._@'\",\\-\\/\\(\\)*]+?)}", - "name": "aws", - "region": "us-east-1", - "versionFunctions": true, - "remoteFunctionData": null, - "compiledCloudFormationTemplate": { - "AWSTemplateFormatVersion": "2010-09-09", - "Description": "The AWS CloudFormation template for this Serverless application", - "Resources": { - "ServerlessDeploymentBucket": { - "Type": "AWS::S3::Bucket", - "Properties": { - "BucketEncryption": { - "ServerSideEncryptionConfiguration": [ - { - "ServerSideEncryptionByDefault": { - "SSEAlgorithm": "AES256" - } - } - ] - } - } - }, - "CustomDashmetricDashwriterDashpython27LogGroup": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "/aws/lambda/integration-tester-dev-custom-metric-writer-python27" - } - }, - "IamRoleLambdaExecution": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "Service": [ - "lambda.amazonaws.com" - ] - }, - "Action": [ - "sts:AssumeRole" - ] - } - ] - }, - "Policies": [ - { - "PolicyName": { - "Fn::Join": [ - "-", - [ - "dev", - "integration-tester", - "lambda" - ] - ] - }, - "PolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "logs:CreateLogStream" - ], - "Resource": [ - { - "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/integration-tester-dev*:*" - } - ] - }, - { - "Effect": "Allow", - "Action": [ - "logs:PutLogEvents" - ], - "Resource": [ - { - "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/integration-tester-dev*:*:*" - } - ] - } - ] - } - } - ], - "Path": "/", - "RoleName": { - "Fn::Join": [ - "-", - [ - "integration-tester", - "dev", - { - "Ref": "AWS::Region" - }, - "lambdaRole" - ] - ] - } - } - }, - "TestLambdaLayer": { - "Type": "AWS::Lambda::LayerVersion", - "Properties": { - "Content": { - "S3Bucket": { - "Ref": "ServerlessDeploymentBucket" - }, - "S3Key": "serverless/integration-tester/dev/1582571794655-2020-02-24T19:16:34.655Z/datadog_lambda_py2.7.zip" - }, - "LayerName": "test" - } - }, - "CustomDashmetricDashwriterDashpython27LambdaFunction": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "ServerlessDeploymentBucket" - }, - "S3Key": "serverless/integration-tester/dev/1582571794655-2020-02-24T19:16:34.655Z/integration-tester.zip" - }, - "FunctionName": "integration-tester-dev-custom-metric-writer-python27", - "Handler": "handler.handle", - "MemorySize": 1024, - "Role": { - "Fn::GetAtt": [ - "IamRoleLambdaExecution", - "Arn" - ] - }, - "Runtime": "python2.7", - "Timeout": 6, - "Layers": [ - { - "Ref": "TestLambdaLayer" - } - ] - }, - "DependsOn": [ - "CustomDashmetricDashwriterDashpython27LogGroup", - "IamRoleLambdaExecution" - ] - }, - "CustomDashmetricDashwriterDashpython27LambdaVersion8Uuw4UZraNHeUFMZ6gOKWETimHZStyXU1J9Csl1Rrxo": { - "Type": "AWS::Lambda::Version", - "DeletionPolicy": "Retain", - "Properties": { - "FunctionName": { - "Ref": "CustomDashmetricDashwriterDashpython27LambdaFunction" - }, - "CodeSha256": "hN8ew3WnFE5Y5SjxBqvugAkr9bLFz+oiWqGPMUqUkV4=" - } - }, - "ApiGatewayRestApi": { - "Type": "AWS::ApiGateway::RestApi", - "Properties": { - "Name": "dev-integration-tester", - "EndpointConfiguration": { - "Types": [ - "EDGE" - ] - } - } - }, - "ApiGatewayResourceHello": { - "Type": "AWS::ApiGateway::Resource", - "Properties": { - "ParentId": { - "Fn::GetAtt": [ - "ApiGatewayRestApi", - "RootResourceId" - ] - }, - "PathPart": "hello", - "RestApiId": { - "Ref": "ApiGatewayRestApi" - } - } - }, - "ApiGatewayMethodHelloGet": { - "Type": "AWS::ApiGateway::Method", - "Properties": { - "HttpMethod": "GET", - "RequestParameters": {}, - "ResourceId": { - "Ref": "ApiGatewayResourceHello" - }, - "RestApiId": { - "Ref": "ApiGatewayRestApi" - }, - "ApiKeyRequired": false, - "AuthorizationType": "NONE", - "Integration": { - "IntegrationHttpMethod": "POST", - "Type": "AWS_PROXY", - "Uri": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":apigateway:", - { - "Ref": "AWS::Region" - }, - ":lambda:path/2015-03-31/functions/", - { - "Fn::GetAtt": [ - "CustomDashmetricDashwriterDashpython27LambdaFunction", - "Arn" - ] - }, - "/invocations" - ] - ] - } - }, - "MethodResponses": [] - } - }, - "ApiGatewayDeployment1582571794121": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ApiGatewayRestApi" - }, - "StageName": "dev" - }, - "DependsOn": [ - "ApiGatewayMethodHelloGet" - ] - }, - "CustomDashmetricDashwriterDashpython27LambdaPermissionApiGateway": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "FunctionName": { - "Fn::GetAtt": [ - "CustomDashmetricDashwriterDashpython27LambdaFunction", - "Arn" - ] - }, - "Action": "lambda:InvokeFunction", - "Principal": "apigateway.amazonaws.com", - "SourceArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":execute-api:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":", - { - "Ref": "ApiGatewayRestApi" - }, - "/*/*" - ] - ] - } - } - } - }, - "Outputs": { - "ServerlessDeploymentBucketName": { - "Value": { - "Ref": "ServerlessDeploymentBucket" - } - }, - "TestLambdaLayerQualifiedArn": { - "Description": "Current Lambda layer version", - "Value": { - "Ref": "TestLambdaLayer" - } - }, - "CustomDashmetricDashwriterDashpython27LambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "CustomDashmetricDashwriterDashpython27LambdaVersion8Uuw4UZraNHeUFMZ6gOKWETimHZStyXU1J9Csl1Rrxo" - } - }, - "ServiceEndpoint": { - "Description": "URL of the service endpoint", - "Value": { - "Fn::Join": [ - "", - [ - "https://", - { - "Ref": "ApiGatewayRestApi" - }, - ".execute-api.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/dev" - ] - ] - } - } - } - }, - "coreCloudFormationTemplate": { - "AWSTemplateFormatVersion": "2010-09-09", - "Description": "The AWS CloudFormation template for this Serverless application", - "Resources": { - "ServerlessDeploymentBucket": { - "Type": "AWS::S3::Bucket", - "Properties": { - "BucketEncryption": { - "ServerSideEncryptionConfiguration": [ - { - "ServerSideEncryptionByDefault": { - "SSEAlgorithm": "AES256" - } - } - ] - } - } - } - }, - "Outputs": { - "ServerlessDeploymentBucketName": { - "Value": { - "Ref": "ServerlessDeploymentBucket" - } - } - } - }, - "vpc": {} - }, - "pluginsData": {}, - "functions": { - "custom-metric-writer-python27": { - "handler": "handler.handle", - "runtime": "python2.7", - "events": [ - { - "http": { - "method": "get", - "path": "hello", - "integration": "AWS_PROXY" - } - } - ], - "layers": [ - { - "Ref": "TestLambdaLayer" - } - ], - "name": "integration-tester-dev-custom-metric-writer-python27", - "package": {}, - "memory": 1024, - "timeout": 6, - "vpc": {} - } - }, - "serviceFilename": "serverless.yml", - "layers": { - "test": { - "package": { - "artifact": "../../.layers/datadog_lambda_py2.7.zip" - } - } - }, - "artifact": "/Users/stephenfirrincieli/go/src/github.com/DataDog/datadog-lambda-layer-python/tests/integration/.serverless/integration-tester.zip" - }, - "package": { - "artifactDirectoryName": "serverless/integration-tester/dev/1582571794655-2020-02-24T19:16:34.655Z", - "artifact": "integration-tester.zip" - } -} \ No newline at end of file diff --git a/tests/integration/compare_to_snapshots.py b/tests/integration/compare_to_snapshots.py new file mode 100644 index 00000000..dd0d0934 --- /dev/null +++ b/tests/integration/compare_to_snapshots.py @@ -0,0 +1,186 @@ +import argparse +import json +import pdb +from pprint import pprint +import sys + + +LAMBDA_KEYWORD_PREFIXES = ["START", "END", "REPORT", "XRAY"] + + +def should_keep_log(log_line): + """Determines if a log line should be kept or ignored + + We want to keep the Lambda keyword log lines and any logs in JSON format, ignore all others + """ + for prefix in LAMBDA_KEYWORD_PREFIXES: + if log_line.startswith(prefix): + return True + + # Keep log lines that are JSON + try: + json.loads(log_line) + return True + except: + return False + + +def parse_args(): + """Parse the function name and logs from the passed args + """ + parser = argparse.ArgumentParser(description="Compare logs to snapshots") + parser.add_argument( + "function_name", + type=str, + help="The name of the function whose logs were passed", + ) + parser.add_argument( + "logs", type=str, help="The newline-separated logs to compare to snapshot" + ) + parser.add_argument( + "--overwrite", + help="Should the existing snapshot be overwritten with the new logs", + action="store_true", + ) + + args = parser.parse_args() + + log_lines = [l.strip() for l in args.logs.split("\n") if should_keep_log(l)] + + return args.function_name, log_lines, args.overwrite + + +def is_trace(log_dict): + """Checks if the dict has the right keys for representing a trace + """ + # TODO + return False + + +def is_metric(log_dict): + """Checks if the dict has the keys to represent a metric + """ + return ( + log_dict.get("e") + and log_dict.get("m") + and log_dict.get("t") + and log_dict.get("v") + ) + + +def do_metrics_match(log_dict, snapshot_log_dict): + """Checks if metrics match, ignoring timestamp + """ + return ( + log_dict.get("m") == snapshot_log_dict.get("m") + and log_dict.get("t") == snapshot_log_dict.get("t") + and log_dict.get("v") == snapshot_log_dict.get("v") + ) + + +def do_log_lines_match(line, snapshot_line): + """Checks if the line matches the snapshot line, ignoring timestamps and execution IDs + """ + # Check for the keyword log lines that Lambda generates + for log_keyword in LAMBDA_KEYWORD_PREFIXES: + line_starts_with_kw = line.startswith(log_keyword) + snapshot_line_starts_with_kw = snapshot_line.startswith(log_keyword) + + # If both lines start with the keyword then they match + if line_starts_with_kw and snapshot_line_starts_with_kw: + return True + + # If only one line starts with the kw they don't match + if line_starts_with_kw or snapshot_line_starts_with_kw: + return False + + try: + line_dict = json.loads(line) + snapshot_line_dict = json.loads(snapshot_line) + + if is_metric(line_dict) and is_metric(snapshot_line_dict): + return do_metrics_match(line_dict, snapshot_line_dict) + + except ValueError: + # At least one of the lines is neither a keyword line or JSON + return False + + return False + + +def do_logsets_match(new_logs, snapshot_logs, function_name): + """Compare new log lines to the snapshot + """ + if len(new_logs) != len(snapshot_logs): + print( + "Log mismatch for function {}. There are {} lines in the new logs but {} lines in the snapshot:".format( + function_name, len(new_logs), len(snapshot_logs) + ) + ) + return False + + for index in range(len(new_logs)): + if not do_log_lines_match(new_logs[index], snapshot_logs[index]): + print( + "Log mismatch for function {}. The log at index {} does not match the snapshot:".format( + function_name, index + ) + ) + print("Snapshot log:\n{}".format(snapshot_logs[index])) + print("New mismatched log:\n{}".format(new_logs[index])) + return False + + return True + + +def get_snapshot_path(function_name): + """Returns the relative path of the snapshot file + """ + return "./snapshots/{}.snapshot".format(function_name) + + +def load_function_snapshot_logs(function_name): + """Load the specified function's log snapshot + """ + # TODO return None if the file doesn't exist + with open(get_snapshot_path(function_name), "r") as f: + return f.read().split("\n") + + +def write_snapshot_file(function_name, logs): + """Create a new snapshot file based on the logs and overwrite the existing snapshot + """ + # TODO remove any potentially sensitive info from the logs + with open(get_snapshot_path(function_name), "w") as f: + f.write("\n".join(logs)) + + +def main(): + function_name, log_lines, should_overwrite = parse_args() + if should_overwrite: + print("Overwriting snapshot for {}".format(function_name)) + write_snapshot_file(function_name, log_lines) + return + + snapshot_logs = load_function_snapshot_logs(function_name) + + logsets_match = do_logsets_match(log_lines, snapshot_logs, function_name) + + if not logsets_match: + print( + "Logsets for {} do not match because of errors printed above".format( + function_name + ) + ) + print("New logs:") + pprint(log_lines) + print("Snapshot logs:") + pprint(snapshot_logs) + sys.exit(1) + + print("Newly generated logs for {} match snapshot".format(function_name)) + + +if __name__ == "__main__": + main() + diff --git a/tests/integration/serverless.yml b/tests/integration/serverless.yml index 5067c84e..4988777d 100644 --- a/tests/integration/serverless.yml +++ b/tests/integration/serverless.yml @@ -2,19 +2,53 @@ service: integration-tester provider: name: aws + tracing: + lambda: true + apiGateway: true layers: - test: + python27: package: artifact: ../../.layers/datadog_lambda_py2.7.zip + python36: + package: + artifact: ../../.layers/datadog_lambda_py3.6.zip + python37: + package: + artifact: ../../.layers/datadog_lambda_py3.7.zip + python38: + package: + artifact: ../../.layers/datadog_lambda_py3.8.zip functions: - custom-metric-writer-python27: - handler: handler.handle + async-metrics-python27: + handler: submit_metrics.handle runtime: python2.7 - events: - - http: - method: get - path: /hello layers: - - { Ref: TestLambdaLayer } # Refers to the local lambda created above + - { Ref: Python27LambdaLayer } + environment: + DD_FLUSH_TO_LOG: true + + async-metrics-python36: + handler: submit_metrics.handle + runtime: python3.6 + layers: + - { Ref: Python36LambdaLayer } + environment: + DD_FLUSH_TO_LOG: true + + async-metrics-python37: + handler: submit_metrics.handle + runtime: python3.7 + layers: + - { Ref: Python37LambdaLayer } + environment: + DD_FLUSH_TO_LOG: true + + async-metrics-python38: + handler: submit_metrics.handle + runtime: python3.8 + layers: + - { Ref: Python38LambdaLayer } + environment: + DD_FLUSH_TO_LOG: true diff --git a/tests/integration/snapshots/async-metrics-python27.snapshot b/tests/integration/snapshots/async-metrics-python27.snapshot new file mode 100644 index 00000000..21846deb --- /dev/null +++ b/tests/integration/snapshots/async-metrics-python27.snapshot @@ -0,0 +1,7 @@ +START RequestId: 52a91002-e7b9-4019-9f16-ae7c82d0f7c9 Version: $LATEST +{"e": 1582672407, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": 1582672407, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": 1582672407, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 21} +END RequestId: 52a91002-e7b9-4019-9f16-ae7c82d0f7c9 +REPORT RequestId: 52a91002-e7b9-4019-9f16-ae7c82d0f7c9 Duration: 1.41 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 75 MB Init Duration: 729.25 ms +XRAY TraceId: 1-5e55aa16-e0ccc92ecaf49c3969dd294e SegmentId: 0906416e51b365a2 Sampled: true \ No newline at end of file diff --git a/tests/integration/snapshots/async-metrics-python36.snapshot b/tests/integration/snapshots/async-metrics-python36.snapshot new file mode 100644 index 00000000..72e70074 --- /dev/null +++ b/tests/integration/snapshots/async-metrics-python36.snapshot @@ -0,0 +1,7 @@ +START RequestId: 2543f352-8c56-4fd3-bccf-4261c5dfc3a6 Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": 1582672410, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "hello.dog", "v": 1, "e": 1582672410, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "tests.integration.count", "v": 21, "e": 1582672410, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} +END RequestId: 2543f352-8c56-4fd3-bccf-4261c5dfc3a6 +REPORT RequestId: 2543f352-8c56-4fd3-bccf-4261c5dfc3a6 Duration: 0.90 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 81 MB Init Duration: 795.29 ms +XRAY TraceId: 1-5e55aa19-aa6c985ce9f5b63832c5185c SegmentId: 0cefa8794909c072 Sampled: true \ No newline at end of file diff --git a/tests/integration/snapshots/async-metrics-python37.snapshot b/tests/integration/snapshots/async-metrics-python37.snapshot new file mode 100644 index 00000000..8d8d6ea2 --- /dev/null +++ b/tests/integration/snapshots/async-metrics-python37.snapshot @@ -0,0 +1,7 @@ +START RequestId: 23bbb9a2-895e-4961-95c2-f717fcd40132 Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": 1582672413, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "hello.dog", "v": 1, "e": 1582672413, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "tests.integration.count", "v": 21, "e": 1582672413, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} +END RequestId: 23bbb9a2-895e-4961-95c2-f717fcd40132 +REPORT RequestId: 23bbb9a2-895e-4961-95c2-f717fcd40132 Duration: 2.65 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 86 MB Init Duration: 868.97 ms +XRAY TraceId: 1-5e55aa1c-1f23e7c096af044e9c9412fa SegmentId: 6cb6910b76128a0c Sampled: true \ No newline at end of file diff --git a/tests/integration/snapshots/async-metrics-python38.snapshot b/tests/integration/snapshots/async-metrics-python38.snapshot new file mode 100644 index 00000000..3feb65cb --- /dev/null +++ b/tests/integration/snapshots/async-metrics-python38.snapshot @@ -0,0 +1,7 @@ +START RequestId: 6e07a202-80cd-4160-af5b-e7ea7f15572d Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": 1582672416, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "hello.dog", "v": 1, "e": 1582672416, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "tests.integration.count", "v": 21, "e": 1582672416, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} +END RequestId: 6e07a202-80cd-4160-af5b-e7ea7f15572d +REPORT RequestId: 6e07a202-80cd-4160-af5b-e7ea7f15572d Duration: 2.03 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 88 MB Init Duration: 858.27 ms +XRAY TraceId: 1-5e55aa1e-455a8800ca8e49005ac6f600 SegmentId: 7b4452a8414eb90e Sampled: true \ No newline at end of file diff --git a/tests/integration/handler.py b/tests/integration/submit_metrics.py similarity index 56% rename from tests/integration/handler.py rename to tests/integration/submit_metrics.py index 782f9d10..1fa94cbd 100644 --- a/tests/integration/handler.py +++ b/tests/integration/submit_metrics.py @@ -6,5 +6,8 @@ @datadog_lambda_wrapper def handle(event, context): - lambda_metric("hello.dog", 1) + lambda_metric("hello.dog", 1, tags=["team:serverless", "role:hello"]) + lambda_metric( + "tests.integration.count", 21, tags=["test:integration", "role:hello"] + ) return {"statusCode": 200, "body": "hello, dog!"} From b3ebc80b0bf7111a09e693e197ce8c950093c79f Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Wed, 26 Feb 2020 17:35:57 -0500 Subject: [PATCH 03/19] Make integration test work for async metrics --- scripts/run_integration_tests.sh | 76 +++++-- tests/integration/compare_to_snapshots.py | 186 ------------------ tests/integration/serverless.yml | 32 +++ .../snapshots/async-metrics-python27.logs | 7 + .../async-metrics-python27.return_value | 4 + .../snapshots/async-metrics-python27.snapshot | 7 - .../snapshots/async-metrics-python36.logs | 7 + .../async-metrics-python36.return_value | 4 + .../snapshots/async-metrics-python36.snapshot | 7 - .../snapshots/async-metrics-python37.logs | 7 + .../async-metrics-python37.return_value | 4 + .../snapshots/async-metrics-python37.snapshot | 7 - .../snapshots/async-metrics-python38.logs | 17 ++ .../async-metrics-python38.return_value | 4 + .../snapshots/async-metrics-python38.snapshot | 7 - 15 files changed, 151 insertions(+), 225 deletions(-) delete mode 100644 tests/integration/compare_to_snapshots.py create mode 100644 tests/integration/snapshots/async-metrics-python27.logs create mode 100644 tests/integration/snapshots/async-metrics-python27.return_value delete mode 100644 tests/integration/snapshots/async-metrics-python27.snapshot create mode 100644 tests/integration/snapshots/async-metrics-python36.logs create mode 100644 tests/integration/snapshots/async-metrics-python36.return_value delete mode 100644 tests/integration/snapshots/async-metrics-python36.snapshot create mode 100644 tests/integration/snapshots/async-metrics-python37.logs create mode 100644 tests/integration/snapshots/async-metrics-python37.return_value delete mode 100644 tests/integration/snapshots/async-metrics-python37.snapshot create mode 100644 tests/integration/snapshots/async-metrics-python38.logs create mode 100644 tests/integration/snapshots/async-metrics-python38.return_value delete mode 100644 tests/integration/snapshots/async-metrics-python38.snapshot diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index b45be456..ac1c5980 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -1,5 +1,6 @@ #!/bin/bash +# Stop execution if any command has errors set -e # These values need to be in sync with serverless.yml, where there needs to be a function @@ -16,11 +17,17 @@ integration_tests_dir="$repo_dir/tests/integration" script_start_time=$(date --iso-8601=seconds) +mismatch_found=false + echo "Start time is $script_start_time" -echo "Building new layers that will be uploaded with our test functions" +echo "Building layers that will be deployed with our test functions" # source $scripts_dir/build_layers.sh +if [ -n "$OVERWRITE" ]; then + echo "Overwriting snapshots in this execution" +fi + echo "Deploying functions" cd $integration_tests_dir serverless deploy @@ -28,25 +35,72 @@ serverless deploy echo "Invoking functions" for handler_name in "${LAMBDA_HANDLERS[@]}"; do for runtime in "${RUNTIMES[@]}"; do - echo "Invoking $handler_name-$runtime" - serverless invoke -f "$handler_name-$runtime" + function_name="$handler_name-$runtime" + function_snapshot_path="./snapshots/$function_name.return_value" + + return_value=$(serverless invoke -f $function_name) + + if [ -n "$OVERWRITE" ]; then + # If $OVERWRITE is set to true, write the new logs over the current snapshot + echo "Overwriting return value snapshot for $function_name" + echo "$return_value" >$function_snapshot_path + else + # Compare new return value to snapshot + set +e # Don't exit this script if there is a diff + diff_output=$(echo "$return_value" | diff - $function_snapshot_path) + if [ $? -eq 1 ]; then + echo "FAILURE: Return value for $function_name does not match snapshot:" + echo "$diff_output" + mismatch_found=true + else + echo "SUCCESS: Return value for $function_name matches snapshot" + fi + set -e + fi done done -echo "Sleeping for $LOGS_WAIT_SECONDS seconds to wait for logs to appear in CloudWatch..." +echo "Sleeping $LOGS_WAIT_SECONDS seconds to wait for logs to appear in CloudWatch..." sleep $LOGS_WAIT_SECONDS echo "Fetching logs for invocations and comparing to snapshots" for handler_name in "${LAMBDA_HANDLERS[@]}"; do for runtime in "${RUNTIMES[@]}"; do - logs=$(serverless logs -f "$handler_name-$runtime" --startTime $script_start_time) - python compare_to_snapshots.py "$handler_name-$runtime" "$logs" + function_name="$handler_name-$runtime" + function_snapshot_path="./snapshots/$function_name.logs" + + # Fetch logs with serverless cli + logs=$(serverless logs -f $function_name --startTime $script_start_time) + + # Filter serverless cli errors + logs=$(echo "$logs" | sed '/Serverless: Recoverable error occurred/d') + + # Replace invocation-specific data with XXXX to normalize between executions + logs=$(echo "$logs" | sed -E 's/(RequestId|TraceId|SegmentId|Duration|Memory Used|"e"): [a-z0-9\.\-]+/\1: XXXX/g') + + if [ -n "$OVERWRITE" ]; then + # If $OVERWRITE is set to true, write the new logs over the current snapshot + echo "Overwriting snapshot for $function_name" + echo "$logs" >$function_snapshot_path + else + # Compare new logs to snapshots + set +e # Don't exit this script if there is a diff + diff_output=$(echo "$logs" | diff - $function_snapshot_path) + if [ $? -eq 1 ]; then + echo "FAILURE: Mismatch found between new $function_name logs and snapshot:" + echo "$diff_output" + mismatch_found=true + else + echo "SUCCESS: New logs for $function_name match snapshot" + fi + set -e + fi done done -# Go back to the repo root -cd $repo_dir - -# Download the new CloudWatch logs for each Lambda +if [ "$mismatch_found" = true ]; then + echo "TEST FAILED: A mismatch between newly generated logs and a snapshot was found above. If this is expected, re-run this script with OVERWRITE=true to generate new snapshots" + exit 1 +fi -# Filter out all logs that aren't metrics and traces and compare to the snapshots in this repo +echo "TEST SUCCEEDED: No difference found between new logs and snapshots" diff --git a/tests/integration/compare_to_snapshots.py b/tests/integration/compare_to_snapshots.py deleted file mode 100644 index dd0d0934..00000000 --- a/tests/integration/compare_to_snapshots.py +++ /dev/null @@ -1,186 +0,0 @@ -import argparse -import json -import pdb -from pprint import pprint -import sys - - -LAMBDA_KEYWORD_PREFIXES = ["START", "END", "REPORT", "XRAY"] - - -def should_keep_log(log_line): - """Determines if a log line should be kept or ignored - - We want to keep the Lambda keyword log lines and any logs in JSON format, ignore all others - """ - for prefix in LAMBDA_KEYWORD_PREFIXES: - if log_line.startswith(prefix): - return True - - # Keep log lines that are JSON - try: - json.loads(log_line) - return True - except: - return False - - -def parse_args(): - """Parse the function name and logs from the passed args - """ - parser = argparse.ArgumentParser(description="Compare logs to snapshots") - parser.add_argument( - "function_name", - type=str, - help="The name of the function whose logs were passed", - ) - parser.add_argument( - "logs", type=str, help="The newline-separated logs to compare to snapshot" - ) - parser.add_argument( - "--overwrite", - help="Should the existing snapshot be overwritten with the new logs", - action="store_true", - ) - - args = parser.parse_args() - - log_lines = [l.strip() for l in args.logs.split("\n") if should_keep_log(l)] - - return args.function_name, log_lines, args.overwrite - - -def is_trace(log_dict): - """Checks if the dict has the right keys for representing a trace - """ - # TODO - return False - - -def is_metric(log_dict): - """Checks if the dict has the keys to represent a metric - """ - return ( - log_dict.get("e") - and log_dict.get("m") - and log_dict.get("t") - and log_dict.get("v") - ) - - -def do_metrics_match(log_dict, snapshot_log_dict): - """Checks if metrics match, ignoring timestamp - """ - return ( - log_dict.get("m") == snapshot_log_dict.get("m") - and log_dict.get("t") == snapshot_log_dict.get("t") - and log_dict.get("v") == snapshot_log_dict.get("v") - ) - - -def do_log_lines_match(line, snapshot_line): - """Checks if the line matches the snapshot line, ignoring timestamps and execution IDs - """ - # Check for the keyword log lines that Lambda generates - for log_keyword in LAMBDA_KEYWORD_PREFIXES: - line_starts_with_kw = line.startswith(log_keyword) - snapshot_line_starts_with_kw = snapshot_line.startswith(log_keyword) - - # If both lines start with the keyword then they match - if line_starts_with_kw and snapshot_line_starts_with_kw: - return True - - # If only one line starts with the kw they don't match - if line_starts_with_kw or snapshot_line_starts_with_kw: - return False - - try: - line_dict = json.loads(line) - snapshot_line_dict = json.loads(snapshot_line) - - if is_metric(line_dict) and is_metric(snapshot_line_dict): - return do_metrics_match(line_dict, snapshot_line_dict) - - except ValueError: - # At least one of the lines is neither a keyword line or JSON - return False - - return False - - -def do_logsets_match(new_logs, snapshot_logs, function_name): - """Compare new log lines to the snapshot - """ - if len(new_logs) != len(snapshot_logs): - print( - "Log mismatch for function {}. There are {} lines in the new logs but {} lines in the snapshot:".format( - function_name, len(new_logs), len(snapshot_logs) - ) - ) - return False - - for index in range(len(new_logs)): - if not do_log_lines_match(new_logs[index], snapshot_logs[index]): - print( - "Log mismatch for function {}. The log at index {} does not match the snapshot:".format( - function_name, index - ) - ) - print("Snapshot log:\n{}".format(snapshot_logs[index])) - print("New mismatched log:\n{}".format(new_logs[index])) - return False - - return True - - -def get_snapshot_path(function_name): - """Returns the relative path of the snapshot file - """ - return "./snapshots/{}.snapshot".format(function_name) - - -def load_function_snapshot_logs(function_name): - """Load the specified function's log snapshot - """ - # TODO return None if the file doesn't exist - with open(get_snapshot_path(function_name), "r") as f: - return f.read().split("\n") - - -def write_snapshot_file(function_name, logs): - """Create a new snapshot file based on the logs and overwrite the existing snapshot - """ - # TODO remove any potentially sensitive info from the logs - with open(get_snapshot_path(function_name), "w") as f: - f.write("\n".join(logs)) - - -def main(): - function_name, log_lines, should_overwrite = parse_args() - if should_overwrite: - print("Overwriting snapshot for {}".format(function_name)) - write_snapshot_file(function_name, log_lines) - return - - snapshot_logs = load_function_snapshot_logs(function_name) - - logsets_match = do_logsets_match(log_lines, snapshot_logs, function_name) - - if not logsets_match: - print( - "Logsets for {} do not match because of errors printed above".format( - function_name - ) - ) - print("New logs:") - pprint(log_lines) - print("Snapshot logs:") - pprint(snapshot_logs) - sys.exit(1) - - print("Newly generated logs for {} match snapshot".format(function_name)) - - -if __name__ == "__main__": - main() - diff --git a/tests/integration/serverless.yml b/tests/integration/serverless.yml index 4988777d..df6429c7 100644 --- a/tests/integration/serverless.yml +++ b/tests/integration/serverless.yml @@ -52,3 +52,35 @@ functions: - { Ref: Python38LambdaLayer } environment: DD_FLUSH_TO_LOG: true + + sync-metrics-python27: + handler: submit_metrics.handle + runtime: python2.7 + layers: + - { Ref: Python27LambdaLayer } + environment: + DD_API_KEY: "abcdefghijk" + + sync-metrics-python36: + handler: submit_metrics.handle + runtime: python3.6 + layers: + - { Ref: Python36LambdaLayer } + environment: + DD_API_KEY: "abcdefghijk" + + sync-metrics-python37: + handler: submit_metrics.handle + runtime: python3.7 + layers: + - { Ref: Python37LambdaLayer } + environment: + DD_API_KEY: "abcdefghijk" + + sync-metrics-python38: + handler: submit_metrics.handle + runtime: python3.8 + layers: + - { Ref: Python38LambdaLayer } + environment: + DD_API_KEY: "abcdefghijk" diff --git a/tests/integration/snapshots/async-metrics-python27.logs b/tests/integration/snapshots/async-metrics-python27.logs new file mode 100644 index 00000000..e11863c4 --- /dev/null +++ b/tests/integration/snapshots/async-metrics-python27.logs @@ -0,0 +1,7 @@ +START RequestId: XXXX Version: $LATEST +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 21} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/async-metrics-python27.return_value b/tests/integration/snapshots/async-metrics-python27.return_value new file mode 100644 index 00000000..403ec11f --- /dev/null +++ b/tests/integration/snapshots/async-metrics-python27.return_value @@ -0,0 +1,4 @@ +{ + "body": "hello, dog!", + "statusCode": 200 +} diff --git a/tests/integration/snapshots/async-metrics-python27.snapshot b/tests/integration/snapshots/async-metrics-python27.snapshot deleted file mode 100644 index 21846deb..00000000 --- a/tests/integration/snapshots/async-metrics-python27.snapshot +++ /dev/null @@ -1,7 +0,0 @@ -START RequestId: 52a91002-e7b9-4019-9f16-ae7c82d0f7c9 Version: $LATEST -{"e": 1582672407, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -{"e": 1582672407, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -{"e": 1582672407, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 21} -END RequestId: 52a91002-e7b9-4019-9f16-ae7c82d0f7c9 -REPORT RequestId: 52a91002-e7b9-4019-9f16-ae7c82d0f7c9 Duration: 1.41 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 75 MB Init Duration: 729.25 ms -XRAY TraceId: 1-5e55aa16-e0ccc92ecaf49c3969dd294e SegmentId: 0906416e51b365a2 Sampled: true \ No newline at end of file diff --git a/tests/integration/snapshots/async-metrics-python36.logs b/tests/integration/snapshots/async-metrics-python36.logs new file mode 100644 index 00000000..983942a8 --- /dev/null +++ b/tests/integration/snapshots/async-metrics-python36.logs @@ -0,0 +1,7 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/async-metrics-python36.return_value b/tests/integration/snapshots/async-metrics-python36.return_value new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/async-metrics-python36.return_value @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/async-metrics-python36.snapshot b/tests/integration/snapshots/async-metrics-python36.snapshot deleted file mode 100644 index 72e70074..00000000 --- a/tests/integration/snapshots/async-metrics-python36.snapshot +++ /dev/null @@ -1,7 +0,0 @@ -START RequestId: 2543f352-8c56-4fd3-bccf-4261c5dfc3a6 Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": 1582672410, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} -{"m": "hello.dog", "v": 1, "e": 1582672410, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} -{"m": "tests.integration.count", "v": 21, "e": 1582672410, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} -END RequestId: 2543f352-8c56-4fd3-bccf-4261c5dfc3a6 -REPORT RequestId: 2543f352-8c56-4fd3-bccf-4261c5dfc3a6 Duration: 0.90 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 81 MB Init Duration: 795.29 ms -XRAY TraceId: 1-5e55aa19-aa6c985ce9f5b63832c5185c SegmentId: 0cefa8794909c072 Sampled: true \ No newline at end of file diff --git a/tests/integration/snapshots/async-metrics-python37.logs b/tests/integration/snapshots/async-metrics-python37.logs new file mode 100644 index 00000000..4da1062b --- /dev/null +++ b/tests/integration/snapshots/async-metrics-python37.logs @@ -0,0 +1,7 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/async-metrics-python37.return_value b/tests/integration/snapshots/async-metrics-python37.return_value new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/async-metrics-python37.return_value @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/async-metrics-python37.snapshot b/tests/integration/snapshots/async-metrics-python37.snapshot deleted file mode 100644 index 8d8d6ea2..00000000 --- a/tests/integration/snapshots/async-metrics-python37.snapshot +++ /dev/null @@ -1,7 +0,0 @@ -START RequestId: 23bbb9a2-895e-4961-95c2-f717fcd40132 Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": 1582672413, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} -{"m": "hello.dog", "v": 1, "e": 1582672413, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} -{"m": "tests.integration.count", "v": 21, "e": 1582672413, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} -END RequestId: 23bbb9a2-895e-4961-95c2-f717fcd40132 -REPORT RequestId: 23bbb9a2-895e-4961-95c2-f717fcd40132 Duration: 2.65 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 86 MB Init Duration: 868.97 ms -XRAY TraceId: 1-5e55aa1c-1f23e7c096af044e9c9412fa SegmentId: 6cb6910b76128a0c Sampled: true \ No newline at end of file diff --git a/tests/integration/snapshots/async-metrics-python38.logs b/tests/integration/snapshots/async-metrics-python38.logs new file mode 100644 index 00000000..0660cefa --- /dev/null +++ b/tests/integration/snapshots/async-metrics-python38.logs @@ -0,0 +1,17 @@ +/opt/python/lib/python3.8/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="? + if x is 0 or x is 1: +/opt/python/lib/python3.8/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="? + if x is 0 or x is 1: +/opt/python/lib/python3.8/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="? + elif y is 0 or y is 1: +/opt/python/lib/python3.8/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="? + elif y is 0 or y is 1: +/opt/python/lib/python3.8/site-packages/jmespath/visitor.py:260: SyntaxWarning: "is" with a literal. Did you mean "=="? + if original_result is 0: +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/async-metrics-python38.return_value b/tests/integration/snapshots/async-metrics-python38.return_value new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/async-metrics-python38.return_value @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/async-metrics-python38.snapshot b/tests/integration/snapshots/async-metrics-python38.snapshot deleted file mode 100644 index 3feb65cb..00000000 --- a/tests/integration/snapshots/async-metrics-python38.snapshot +++ /dev/null @@ -1,7 +0,0 @@ -START RequestId: 6e07a202-80cd-4160-af5b-e7ea7f15572d Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": 1582672416, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} -{"m": "hello.dog", "v": 1, "e": 1582672416, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} -{"m": "tests.integration.count", "v": 21, "e": 1582672416, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} -END RequestId: 6e07a202-80cd-4160-af5b-e7ea7f15572d -REPORT RequestId: 6e07a202-80cd-4160-af5b-e7ea7f15572d Duration: 2.03 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 88 MB Init Duration: 858.27 ms -XRAY TraceId: 1-5e55aa1e-455a8800ca8e49005ac6f600 SegmentId: 7b4452a8414eb90e Sampled: true \ No newline at end of file From e364319b6ec93841f3fce8d4c8961feb27d4865c Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Thu, 27 Feb 2020 17:30:04 -0500 Subject: [PATCH 04/19] Log HTTP requests if DD_INTEGRATION_TEST=true; normalize snapshots more --- datadog_lambda/patch.py | 49 ++++++++------- scripts/run_integration_tests.sh | 62 +++++++++++++------ tests/integration/date | 0 .../{submit_metrics.py => handle.py} | 0 tests/integration/http_requests.py | 16 +++++ tests/integration/serverless.yml | 29 ++++----- .../snapshots/async-metrics-python37.logs | 3 + .../snapshots/async-metrics-python38.logs | 10 --- .../snapshots/sync-metrics-python27.logs | 7 +++ .../sync-metrics-python27.return_value | 4 ++ .../snapshots/sync-metrics-python36.logs | 7 +++ .../sync-metrics-python36.return_value | 4 ++ .../snapshots/sync-metrics-python37.logs | 10 +++ .../sync-metrics-python37.return_value | 4 ++ .../snapshots/sync-metrics-python38.logs | 7 +++ .../sync-metrics-python38.return_value | 4 ++ 16 files changed, 149 insertions(+), 67 deletions(-) create mode 100644 tests/integration/date rename tests/integration/{submit_metrics.py => handle.py} (100%) create mode 100644 tests/integration/http_requests.py create mode 100644 tests/integration/snapshots/sync-metrics-python27.logs create mode 100644 tests/integration/snapshots/sync-metrics-python27.return_value create mode 100644 tests/integration/snapshots/sync-metrics-python36.logs create mode 100644 tests/integration/snapshots/sync-metrics-python36.return_value create mode 100644 tests/integration/snapshots/sync-metrics-python37.logs create mode 100644 tests/integration/snapshots/sync-metrics-python37.return_value create mode 100644 tests/integration/snapshots/sync-metrics-python38.logs create mode 100644 tests/integration/snapshots/sync-metrics-python38.return_value diff --git a/datadog_lambda/patch.py b/datadog_lambda/patch.py index d03ce2be..be3076ba 100644 --- a/datadog_lambda/patch.py +++ b/datadog_lambda/patch.py @@ -3,6 +3,8 @@ # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2019 Datadog, Inc. +import json +import os import sys import logging @@ -13,9 +15,9 @@ logger = logging.getLogger(__name__) if sys.version_info >= (3, 0, 0): - httplib_module = 'http.client' + httplib_module = "http.client" else: - httplib_module = 'httplib' + httplib_module = "httplib" _httplib_patched = False _requests_patched = False @@ -38,12 +40,9 @@ def _patch_httplib(): global _httplib_patched if not _httplib_patched: _httplib_patched = True - wrap( - httplib_module, - 'HTTPConnection.request', - _wrap_httplib_request - ) - logger.debug('Patched %s', httplib_module) + wrap(httplib_module, "HTTPConnection.request", _wrap_httplib_request) + + logger.debug("Patched %s", httplib_module) def _patch_requests(): @@ -55,14 +54,10 @@ def _patch_requests(): if not _requests_patched: _requests_patched = True try: - wrap( - 'requests', - 'Session.request', - _wrap_requests_request - ) - logger.debug('Patched requests') + wrap("requests", "Session.request", _wrap_requests_request) + logger.debug("Patched requests") except Exception: - logger.debug('Failed to patch requests', exc_info=True) + logger.debug("Failed to patch requests", exc_info=True) def _wrap_requests_request(func, instance, args, kwargs): @@ -71,12 +66,18 @@ def _wrap_requests_request(func, instance, args, kwargs): into the outgoing requests. """ context = get_dd_trace_context() - if 'headers' in kwargs: - kwargs['headers'].update(context) + if "headers" in kwargs: + kwargs["headers"].update(context) elif len(args) >= 5: args[4].update(context) else: - kwargs['headers'] = context + kwargs["headers"] = context + + # If we're in an integration test, log the HTTP requests made + if os.environ.get("DD_INTEGRATION_TEST", "false").lower() == "true": + request_string = "HTTP {} Kwargs: {}".format(" ".join(args), kwargs) + print(request_string) + return func(*args, **kwargs) @@ -86,10 +87,16 @@ def _wrap_httplib_request(func, instance, args, kwargs): the Datadog trace headers into the outgoing requests. """ context = get_dd_trace_context() - if 'headers' in kwargs: - kwargs['headers'].update(context) + if "headers" in kwargs: + kwargs["headers"].update(context) elif len(args) >= 4: args[3].update(context) else: - kwargs['headers'] = context + kwargs["headers"] = context + + if os.environ.get("DD_INTEGRATION_TEST", "false").lower() == "true": + request_string = "HTTP {} Kwargs: {}".format(" ".join(args), kwargs) + print(request_string) + return func(*args, **kwargs) + diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index ac1c5980..17be3dd1 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -5,7 +5,7 @@ set -e # These values need to be in sync with serverless.yml, where there needs to be a function # defined for every handler-runtime combination -LAMBDA_HANDLERS=("async-metrics") +LAMBDA_HANDLERS=("async-metrics" "sync-metrics") RUNTIMES=("python27" "python36" "python37" "python38") LOGS_WAIT_SECONDS=20 @@ -21,18 +21,26 @@ mismatch_found=false echo "Start time is $script_start_time" -echo "Building layers that will be deployed with our test functions" -# source $scripts_dir/build_layers.sh - -if [ -n "$OVERWRITE" ]; then +if [ -n "$UPDATE_SNAPSHOTS" ]; then echo "Overwriting snapshots in this execution" fi +if [ -z "$DD_API_KEY" ]; then + echo "No DD_API_KEY env var set, exiting" + exit 1 +else + echo "The API key is $DD_API_KEY" +fi + +echo "Building layers that will be deployed with our test functions" +# source $scripts_dir/build_layers.sh + echo "Deploying functions" cd $integration_tests_dir serverless deploy echo "Invoking functions" +set +e # Don't exit this script if an invocation fails for handler_name in "${LAMBDA_HANDLERS[@]}"; do for runtime in "${RUNTIMES[@]}"; do function_name="$handler_name-$runtime" @@ -40,26 +48,26 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do return_value=$(serverless invoke -f $function_name) - if [ -n "$OVERWRITE" ]; then - # If $OVERWRITE is set to true, write the new logs over the current snapshot + if [ -n "$UPDATE_SNAPSHOTS" ]; then + # If $UPDATE_SNAPSHOTS is set to true, write the new logs over the current snapshot echo "Overwriting return value snapshot for $function_name" echo "$return_value" >$function_snapshot_path else # Compare new return value to snapshot - set +e # Don't exit this script if there is a diff diff_output=$(echo "$return_value" | diff - $function_snapshot_path) if [ $? -eq 1 ]; then - echo "FAILURE: Return value for $function_name does not match snapshot:" + echo "Failed: Return value for $function_name does not match snapshot:" echo "$diff_output" mismatch_found=true else - echo "SUCCESS: Return value for $function_name matches snapshot" + echo "Ok: Return value for $function_name matches snapshot" fi - set -e fi done done +set -e + echo "Sleeping $LOGS_WAIT_SECONDS seconds to wait for logs to appear in CloudWatch..." sleep $LOGS_WAIT_SECONDS @@ -75,23 +83,32 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do # Filter serverless cli errors logs=$(echo "$logs" | sed '/Serverless: Recoverable error occurred/d') - # Replace invocation-specific data with XXXX to normalize between executions + # Replace invocation-specific data like timestamps and IDs with XXXX to normalize logs across executions + # Normalize Lambda runtime report logs logs=$(echo "$logs" | sed -E 's/(RequestId|TraceId|SegmentId|Duration|Memory Used|"e"): [a-z0-9\.\-]+/\1: XXXX/g') - - if [ -n "$OVERWRITE" ]; then - # If $OVERWRITE is set to true, write the new logs over the current snapshot - echo "Overwriting snapshot for $function_name" + # Normalize DD APM headers + logs=$(echo "$logs" | sed -E "s/('x-datadog-parent-id': '|'x-datadog-trace-id': ')[0-9]+/\1XXXX/g") + # Normalize timestamps logged requests + logs=$(echo "$logs" | sed -E 's/"points": \[\[[0-9\.]+,/"points": \[\[XXXX,/g') + # Normalize the invocation IDs used in requests to the Lambda runtime + logs=$(echo "$logs" | sed -E 's/\/2018-06-01\/runtime\/invocation\/[a-z0-9-]+/\/2018-06-01\/runtime\/invocation\/XXXX/g') + # Strip API key from logged requests + logs=$(echo "$logs" | sed -E "s/(api_key=|'api_key': ')[a-z0-9\.\-]+/\1XXXX/g") + + if [ -n "$UPDATE_SNAPSHOTS" ]; then + # If $UPDATE_SNAPSHOTS is set to true, write the new logs over the current snapshot + echo "Overwriting log snapshot for $function_name" echo "$logs" >$function_snapshot_path else # Compare new logs to snapshots set +e # Don't exit this script if there is a diff diff_output=$(echo "$logs" | diff - $function_snapshot_path) if [ $? -eq 1 ]; then - echo "FAILURE: Mismatch found between new $function_name logs and snapshot:" + echo "Failed: Mismatch found between new $function_name logs and snapshot:" echo "$diff_output" mismatch_found=true else - echo "SUCCESS: New logs for $function_name match snapshot" + echo "Ok: New logs for $function_name match snapshot" fi set -e fi @@ -99,8 +116,13 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do done if [ "$mismatch_found" = true ]; then - echo "TEST FAILED: A mismatch between newly generated logs and a snapshot was found above. If this is expected, re-run this script with OVERWRITE=true to generate new snapshots" + echo "FAILURE: A mismatch between new data and a snapshot was found and printed above. If the change is expected, generate new snapshots by running 'UPDATE_SNAPSHOTS=true ./scripts/run_integration_tests.sh'" exit 1 fi -echo "TEST SUCCEEDED: No difference found between new logs and snapshots" +if [ -n "$UPDATE_SNAPSHOTS" ]; then + echo "SUCCESS: Wrote new snapshots for all functions" + exit 0 +fi + +echo "SUCCESS: No difference found between new logs and snapshots" diff --git a/tests/integration/date b/tests/integration/date new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/submit_metrics.py b/tests/integration/handle.py similarity index 100% rename from tests/integration/submit_metrics.py rename to tests/integration/handle.py diff --git a/tests/integration/http_requests.py b/tests/integration/http_requests.py new file mode 100644 index 00000000..3becdb39 --- /dev/null +++ b/tests/integration/http_requests.py @@ -0,0 +1,16 @@ +import json +import requests + +from datadog_lambda.metric import lambda_metric +from datadog_lambda.wrapper import datadog_lambda_wrapper + + +@datadog_lambda_wrapper +def handle(event, context): + lambda_metric("hello.dog", 1, tags=["team:serverless", "role:hello"]) + lambda_metric( + "tests.integration.count", 21, tags=["test:integration", "role:hello"] + ) + response = requests.get("https://datadoghq.com") + + return {"statusCode": 200, "body": "hello, dog!"} diff --git a/tests/integration/serverless.yml b/tests/integration/serverless.yml index df6429c7..052ceabf 100644 --- a/tests/integration/serverless.yml +++ b/tests/integration/serverless.yml @@ -5,6 +5,9 @@ provider: tracing: lambda: true apiGateway: true + environment: + DD_INTEGRATION_TEST: true + DD_API_KEY: ${env:DD_API_KEY} layers: python27: @@ -21,8 +24,9 @@ layers: artifact: ../../.layers/datadog_lambda_py3.8.zip functions: + # async-metrics async-metrics-python27: - handler: submit_metrics.handle + handler: handle.handle runtime: python2.7 layers: - { Ref: Python27LambdaLayer } @@ -30,7 +34,7 @@ functions: DD_FLUSH_TO_LOG: true async-metrics-python36: - handler: submit_metrics.handle + handler: handle.handle runtime: python3.6 layers: - { Ref: Python36LambdaLayer } @@ -38,7 +42,7 @@ functions: DD_FLUSH_TO_LOG: true async-metrics-python37: - handler: submit_metrics.handle + handler: handle.handle runtime: python3.7 layers: - { Ref: Python37LambdaLayer } @@ -46,41 +50,34 @@ functions: DD_FLUSH_TO_LOG: true async-metrics-python38: - handler: submit_metrics.handle + handler: handle.handle runtime: python3.8 layers: - { Ref: Python38LambdaLayer } environment: DD_FLUSH_TO_LOG: true + # sync-metrics sync-metrics-python27: - handler: submit_metrics.handle + handler: handle.handle runtime: python2.7 layers: - { Ref: Python27LambdaLayer } - environment: - DD_API_KEY: "abcdefghijk" sync-metrics-python36: - handler: submit_metrics.handle + handler: handle.handle runtime: python3.6 layers: - { Ref: Python36LambdaLayer } - environment: - DD_API_KEY: "abcdefghijk" sync-metrics-python37: - handler: submit_metrics.handle + handler: handle.handle runtime: python3.7 layers: - { Ref: Python37LambdaLayer } - environment: - DD_API_KEY: "abcdefghijk" sync-metrics-python38: - handler: submit_metrics.handle + handler: handle.handle runtime: python3.8 layers: - { Ref: Python38LambdaLayer } - environment: - DD_API_KEY: "abcdefghijk" diff --git a/tests/integration/snapshots/async-metrics-python37.logs b/tests/integration/snapshots/async-metrics-python37.logs index 4da1062b..90778295 100644 --- a/tests/integration/snapshots/async-metrics-python37.logs +++ b/tests/integration/snapshots/async-metrics-python37.logs @@ -1,7 +1,10 @@ +HTTP GET /2018-06-01/runtime/invocation/XXXX Kwargs: {'headers': {'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '-1'}} START RequestId: XXXX Version: $LATEST {"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} {"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} {"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} +HTTP POST /2018-06-01/runtime/invocation/XXXX/response {"statusCode": 200, "body": "hello, dog!"} Kwargs: {'headers': {'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2'}} +HTTP GET /2018-06-01/runtime/invocation/XXXX Kwargs: {'headers': {'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2'}} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/async-metrics-python38.logs b/tests/integration/snapshots/async-metrics-python38.logs index 0660cefa..8d9a6ad2 100644 --- a/tests/integration/snapshots/async-metrics-python38.logs +++ b/tests/integration/snapshots/async-metrics-python38.logs @@ -1,13 +1,3 @@ -/opt/python/lib/python3.8/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="? - if x is 0 or x is 1: -/opt/python/lib/python3.8/site-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="? - if x is 0 or x is 1: -/opt/python/lib/python3.8/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="? - elif y is 0 or y is 1: -/opt/python/lib/python3.8/site-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="? - elif y is 0 or y is 1: -/opt/python/lib/python3.8/site-packages/jmespath/visitor.py:260: SyntaxWarning: "is" with a literal. Did you mean "=="? - if original_result is 0: START RequestId: XXXX Version: $LATEST {"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} {"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} diff --git a/tests/integration/snapshots/sync-metrics-python27.logs b/tests/integration/snapshots/sync-metrics-python27.logs new file mode 100644 index 00000000..c5a3658d --- /dev/null +++ b/tests/integration/snapshots/sync-metrics-python27.logs @@ -0,0 +1,7 @@ +START RequestId: XXXX Version: $LATEST +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics-python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Kwargs: {'verify': True, 'headers': {'x-datadog-trace-id': 'XXXX', 'Content-Type': 'application/json', 'x-datadog-sampling-priority': '2', 'x-datadog-parent-id': 'XXXX'}, 'params': {'api_key': 'XXXX'}, 'timeout': 60, 'proxies': None, 'data': '{"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]}'} +HTTP POST /api/v1/distribution_points?api_key=XXXX Kwargs: {'body': '{"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]}', 'headers': {'Content-Length': '460', 'Accept-Encoding': 'gzip, deflate', 'x-datadog-sampling-priority': '2', 'Accept': '*/*', 'User-Agent': 'python-requests/2.23.0', 'Connection': 'keep-alive', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'Content-Type': 'application/json'}} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/sync-metrics-python27.return_value b/tests/integration/snapshots/sync-metrics-python27.return_value new file mode 100644 index 00000000..403ec11f --- /dev/null +++ b/tests/integration/snapshots/sync-metrics-python27.return_value @@ -0,0 +1,4 @@ +{ + "body": "hello, dog!", + "statusCode": 200 +} diff --git a/tests/integration/snapshots/sync-metrics-python36.logs b/tests/integration/snapshots/sync-metrics-python36.logs new file mode 100644 index 00000000..607cb59f --- /dev/null +++ b/tests/integration/snapshots/sync-metrics-python36.logs @@ -0,0 +1,7 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics-python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Kwargs: {'headers': {'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2'}, 'params': {'api_key': 'XXXX'}, 'data': '{"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]}', 'timeout': 60, 'proxies': None, 'verify': True} +HTTP POST /api/v1/distribution_points?api_key=XXXX Kwargs: {'body': '{"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]}', 'headers': {'User-Agent': 'python-requests/2.23.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2', 'Content-Length': '460'}} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/sync-metrics-python36.return_value b/tests/integration/snapshots/sync-metrics-python36.return_value new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/sync-metrics-python36.return_value @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/sync-metrics-python37.logs b/tests/integration/snapshots/sync-metrics-python37.logs new file mode 100644 index 00000000..701b36b0 --- /dev/null +++ b/tests/integration/snapshots/sync-metrics-python37.logs @@ -0,0 +1,10 @@ +HTTP GET /2018-06-01/runtime/invocation/XXXX Kwargs: {'headers': {'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '-1'}} +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics-python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Kwargs: {'headers': {'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2'}, 'params': {'api_key': 'XXXX'}, 'data': '{"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]}', 'timeout': 60, 'proxies': None, 'verify': True} +HTTP POST /api/v1/distribution_points?api_key=XXXX Kwargs: {'body': '{"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]}', 'headers': {'User-Agent': 'python-requests/2.23.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2', 'Content-Length': '460'}} +HTTP POST /2018-06-01/runtime/invocation/XXXX/response {"statusCode": 200, "body": "hello, dog!"} Kwargs: {'headers': {'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2'}} +HTTP GET /2018-06-01/runtime/invocation/XXXX Kwargs: {'headers': {'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2'}} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/sync-metrics-python37.return_value b/tests/integration/snapshots/sync-metrics-python37.return_value new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/sync-metrics-python37.return_value @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/sync-metrics-python38.logs b/tests/integration/snapshots/sync-metrics-python38.logs new file mode 100644 index 00000000..59deaf67 --- /dev/null +++ b/tests/integration/snapshots/sync-metrics-python38.logs @@ -0,0 +1,7 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics-python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Kwargs: {'headers': {'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2'}, 'params': {'api_key': 'XXXX'}, 'data': '{"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]}', 'timeout': 60, 'proxies': None, 'verify': True} +HTTP POST /api/v1/distribution_points?api_key=XXXX Kwargs: {'body': '{"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]}', 'headers': {'User-Agent': 'python-requests/2.23.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2', 'Content-Length': '460'}} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/sync-metrics-python38.return_value b/tests/integration/snapshots/sync-metrics-python38.return_value new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/sync-metrics-python38.return_value @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} From 165f78a1fd499703257b501ae45fae41ce7c5422 Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Thu, 27 Feb 2020 17:33:40 -0500 Subject: [PATCH 05/19] Fix formatting --- datadog_lambda/patch.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/datadog_lambda/patch.py b/datadog_lambda/patch.py index be3076ba..2fd2443f 100644 --- a/datadog_lambda/patch.py +++ b/datadog_lambda/patch.py @@ -3,7 +3,6 @@ # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2019 Datadog, Inc. -import json import os import sys import logging @@ -99,4 +98,3 @@ def _wrap_httplib_request(func, instance, args, kwargs): print(request_string) return func(*args, **kwargs) - From 6c1a9921d45e58d59cf688b3b4eedb75af956b94 Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Fri, 28 Feb 2020 13:01:01 -0500 Subject: [PATCH 06/19] Normalize logged HTTP requests --- datadog_lambda/patch.py | 47 ++++++++++++++++--- scripts/run_integration_tests.sh | 33 +++++++------ tests/integration/http_requests.py | 4 +- tests/integration/serverless.yml | 25 ++++++++++ .../snapshots/async-metrics-python37.logs | 3 -- .../snapshots/http-requests-python27.logs | 8 ++++ .../http-requests-python27.return_value | 4 ++ .../snapshots/http-requests-python36.logs | 8 ++++ .../http-requests-python36.return_value | 4 ++ .../snapshots/http-requests-python37.logs | 8 ++++ .../http-requests-python37.return_value | 4 ++ .../snapshots/http-requests-python38.logs | 8 ++++ .../http-requests-python38.return_value | 4 ++ .../snapshots/sync-metrics-python27.logs | 3 +- .../snapshots/sync-metrics-python36.logs | 3 +- .../snapshots/sync-metrics-python37.logs | 6 +-- .../snapshots/sync-metrics-python38.logs | 3 +- 17 files changed, 139 insertions(+), 36 deletions(-) create mode 100644 tests/integration/snapshots/http-requests-python27.logs create mode 100644 tests/integration/snapshots/http-requests-python27.return_value create mode 100644 tests/integration/snapshots/http-requests-python36.logs create mode 100644 tests/integration/snapshots/http-requests-python36.return_value create mode 100644 tests/integration/snapshots/http-requests-python37.logs create mode 100644 tests/integration/snapshots/http-requests-python37.return_value create mode 100644 tests/integration/snapshots/http-requests-python38.logs create mode 100644 tests/integration/snapshots/http-requests-python38.return_value diff --git a/datadog_lambda/patch.py b/datadog_lambda/patch.py index 2fd2443f..a27282de 100644 --- a/datadog_lambda/patch.py +++ b/datadog_lambda/patch.py @@ -3,6 +3,7 @@ # This product includes software developed at Datadog (https://www.datadoghq.com/). # Copyright 2019 Datadog, Inc. +import json import os import sys import logging @@ -74,8 +75,7 @@ def _wrap_requests_request(func, instance, args, kwargs): # If we're in an integration test, log the HTTP requests made if os.environ.get("DD_INTEGRATION_TEST", "false").lower() == "true": - request_string = "HTTP {} Kwargs: {}".format(" ".join(args), kwargs) - print(request_string) + _print_request_string(args, kwargs) return func(*args, **kwargs) @@ -93,8 +93,43 @@ def _wrap_httplib_request(func, instance, args, kwargs): else: kwargs["headers"] = context - if os.environ.get("DD_INTEGRATION_TEST", "false").lower() == "true": - request_string = "HTTP {} Kwargs: {}".format(" ".join(args), kwargs) - print(request_string) - return func(*args, **kwargs) + + +def _print_request_string(args, kwargs): + """Print the request so that it can be checked in integration tests + + Only used by integration tests. + """ + # Normalizes the different ways args can be passed to a request + # to prevent test flakiness + method = None + if len(args) > 0: + method = args[0] + else: + method = kwargs.get("method", "").upper() + + url = None + if len(args) > 1: + url = args[1] + else: + url = kwargs.get("url") + + # Sort the datapoints POSTed by their name so that snapshots always align + data = kwargs.get("data", "{}") + data_dict = json.loads(data) + data_dict.get("series", []).sort(key=lambda series: series.get("metric")) + sorted_data = json.dumps(data_dict) + + # Sort headers to prevent any differences in ordering + headers = kwargs.get("headers", {}) + sorted_headers = sorted( + "{}:{}".format(key, value) for key, value in headers.items() + ) + sorted_header_str = json.dumps(sorted_headers) + print( + "HTTP {} {} Headers: {} Data: {}".format( + method, url, sorted_header_str, sorted_data + ) + ) + diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index 17be3dd1..7fd9207b 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -5,7 +5,7 @@ set -e # These values need to be in sync with serverless.yml, where there needs to be a function # defined for every handler-runtime combination -LAMBDA_HANDLERS=("async-metrics" "sync-metrics") +LAMBDA_HANDLERS=("async-metrics" "sync-metrics" "http-requests") RUNTIMES=("python27" "python36" "python37" "python38") LOGS_WAIT_SECONDS=20 @@ -28,12 +28,14 @@ fi if [ -z "$DD_API_KEY" ]; then echo "No DD_API_KEY env var set, exiting" exit 1 -else - echo "The API key is $DD_API_KEY" fi -echo "Building layers that will be deployed with our test functions" -# source $scripts_dir/build_layers.sh +if [ -n "$BUILD_LAYERS" ]; then + echo "Building layers that will be deployed with our test functions" + source $scripts_dir/build_layers.sh +else + echo "Not building layers, ensure they've already been built or re-run with 'REBUILD_LAYERS=true ./scripts/run_integration_tests.sh'" +fi echo "Deploying functions" cd $integration_tests_dir @@ -48,9 +50,9 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do return_value=$(serverless invoke -f $function_name) - if [ -n "$UPDATE_SNAPSHOTS" ]; then + if [ -n "$UPDATE_SNAPSHOTS" ] || [ ! -f $function_snapshot_path ]; then # If $UPDATE_SNAPSHOTS is set to true, write the new logs over the current snapshot - echo "Overwriting return value snapshot for $function_name" + echo "Writing return value snapshot for $function_name" echo "$return_value" >$function_snapshot_path else # Compare new return value to snapshot @@ -87,24 +89,25 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do # Normalize Lambda runtime report logs logs=$(echo "$logs" | sed -E 's/(RequestId|TraceId|SegmentId|Duration|Memory Used|"e"): [a-z0-9\.\-]+/\1: XXXX/g') # Normalize DD APM headers - logs=$(echo "$logs" | sed -E "s/('x-datadog-parent-id': '|'x-datadog-trace-id': ')[0-9]+/\1XXXX/g") - # Normalize timestamps logged requests + logs=$(echo "$logs" | sed -E "s/(x-datadog-parent-id:|x-datadog-trace-id:)[0-9]+/\1XXXX/g") + # Normalize timestamps in datapoints POSTed to DD logs=$(echo "$logs" | sed -E 's/"points": \[\[[0-9\.]+,/"points": \[\[XXXX,/g') - # Normalize the invocation IDs used in requests to the Lambda runtime - logs=$(echo "$logs" | sed -E 's/\/2018-06-01\/runtime\/invocation\/[a-z0-9-]+/\/2018-06-01\/runtime\/invocation\/XXXX/g') + # # Normalize invocation IDs used in requests to the Lambda runtime + # logs=$(echo "$logs" | sed -E 's/\/2018-06-01\/runtime\/invocation\/[a-z0-9-]+/\/2018-06-01\/runtime\/invocation\/XXXX/g') # Strip API key from logged requests logs=$(echo "$logs" | sed -E "s/(api_key=|'api_key': ')[a-z0-9\.\-]+/\1XXXX/g") - if [ -n "$UPDATE_SNAPSHOTS" ]; then - # If $UPDATE_SNAPSHOTS is set to true, write the new logs over the current snapshot - echo "Overwriting log snapshot for $function_name" + if [ -n "$UPDATE_SNAPSHOTS" ] || [ ! -f $function_snapshot_path ]; then + # If $UPDATE_SNAPSHOTS is set to true write the new logs over the current snapshot + # If no file exists yet, we create one + echo "Writing log snapshot for $function_name" echo "$logs" >$function_snapshot_path else # Compare new logs to snapshots set +e # Don't exit this script if there is a diff diff_output=$(echo "$logs" | diff - $function_snapshot_path) if [ $? -eq 1 ]; then - echo "Failed: Mismatch found between new $function_name logs and snapshot:" + echo "Failed: Mismatch found between new $function_name logs (first) and snapshot (second):" echo "$diff_output" mismatch_found=true else diff --git a/tests/integration/http_requests.py b/tests/integration/http_requests.py index 3becdb39..3dabd09d 100644 --- a/tests/integration/http_requests.py +++ b/tests/integration/http_requests.py @@ -11,6 +11,8 @@ def handle(event, context): lambda_metric( "tests.integration.count", 21, tags=["test:integration", "role:hello"] ) - response = requests.get("https://datadoghq.com") + + us_response = requests.get("https://ip-ranges.datadoghq.com/") + eu_response = requests.get("https://ip-ranges.datadoghq.eu/") return {"statusCode": 200, "body": "hello, dog!"} diff --git a/tests/integration/serverless.yml b/tests/integration/serverless.yml index 052ceabf..0b769a94 100644 --- a/tests/integration/serverless.yml +++ b/tests/integration/serverless.yml @@ -81,3 +81,28 @@ functions: runtime: python3.8 layers: - { Ref: Python38LambdaLayer } + + # http-requests + http-requests-python27: + handler: http_requests.handle + runtime: python2.7 + layers: + - { Ref: Python27LambdaLayer } + + http-requests-python36: + handler: http_requests.handle + runtime: python3.6 + layers: + - { Ref: Python36LambdaLayer } + + http-requests-python37: + handler: http_requests.handle + runtime: python3.7 + layers: + - { Ref: Python37LambdaLayer } + + http-requests-python38: + handler: http_requests.handle + runtime: python3.8 + layers: + - { Ref: Python38LambdaLayer } diff --git a/tests/integration/snapshots/async-metrics-python37.logs b/tests/integration/snapshots/async-metrics-python37.logs index 90778295..4da1062b 100644 --- a/tests/integration/snapshots/async-metrics-python37.logs +++ b/tests/integration/snapshots/async-metrics-python37.logs @@ -1,10 +1,7 @@ -HTTP GET /2018-06-01/runtime/invocation/XXXX Kwargs: {'headers': {'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '-1'}} START RequestId: XXXX Version: $LATEST {"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} {"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} {"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} -HTTP POST /2018-06-01/runtime/invocation/XXXX/response {"statusCode": 200, "body": "hello, dog!"} Kwargs: {'headers': {'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2'}} -HTTP GET /2018-06-01/runtime/invocation/XXXX Kwargs: {'headers': {'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2'}} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/http-requests-python27.logs b/tests/integration/snapshots/http-requests-python27.logs new file mode 100644 index 00000000..0ba55066 --- /dev/null +++ b/tests/integration/snapshots/http-requests-python27.logs @@ -0,0 +1,8 @@ +START RequestId: XXXX Version: $LATEST +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests-python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/http-requests-python27.return_value b/tests/integration/snapshots/http-requests-python27.return_value new file mode 100644 index 00000000..403ec11f --- /dev/null +++ b/tests/integration/snapshots/http-requests-python27.return_value @@ -0,0 +1,4 @@ +{ + "body": "hello, dog!", + "statusCode": 200 +} diff --git a/tests/integration/snapshots/http-requests-python36.logs b/tests/integration/snapshots/http-requests-python36.logs new file mode 100644 index 00000000..d180d881 --- /dev/null +++ b/tests/integration/snapshots/http-requests-python36.logs @@ -0,0 +1,8 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests-python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/http-requests-python36.return_value b/tests/integration/snapshots/http-requests-python36.return_value new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/http-requests-python36.return_value @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/http-requests-python37.logs b/tests/integration/snapshots/http-requests-python37.logs new file mode 100644 index 00000000..6cf9c301 --- /dev/null +++ b/tests/integration/snapshots/http-requests-python37.logs @@ -0,0 +1,8 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests-python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/http-requests-python37.return_value b/tests/integration/snapshots/http-requests-python37.return_value new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/http-requests-python37.return_value @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/http-requests-python38.logs b/tests/integration/snapshots/http-requests-python38.logs new file mode 100644 index 00000000..0c4a0016 --- /dev/null +++ b/tests/integration/snapshots/http-requests-python38.logs @@ -0,0 +1,8 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests-python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/http-requests-python38.return_value b/tests/integration/snapshots/http-requests-python38.return_value new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/http-requests-python38.return_value @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/sync-metrics-python27.logs b/tests/integration/snapshots/sync-metrics-python27.logs index c5a3658d..e4735bdc 100644 --- a/tests/integration/snapshots/sync-metrics-python27.logs +++ b/tests/integration/snapshots/sync-metrics-python27.logs @@ -1,7 +1,6 @@ START RequestId: XXXX Version: $LATEST {"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics-python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Kwargs: {'verify': True, 'headers': {'x-datadog-trace-id': 'XXXX', 'Content-Type': 'application/json', 'x-datadog-sampling-priority': '2', 'x-datadog-parent-id': 'XXXX'}, 'params': {'api_key': 'XXXX'}, 'timeout': 60, 'proxies': None, 'data': '{"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]}'} -HTTP POST /api/v1/distribution_points?api_key=XXXX Kwargs: {'body': '{"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]}', 'headers': {'Content-Length': '460', 'Accept-Encoding': 'gzip, deflate', 'x-datadog-sampling-priority': '2', 'Accept': '*/*', 'User-Agent': 'python-requests/2.23.0', 'Connection': 'keep-alive', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'Content-Type': 'application/json'}} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/sync-metrics-python36.logs b/tests/integration/snapshots/sync-metrics-python36.logs index 607cb59f..d32fcdf3 100644 --- a/tests/integration/snapshots/sync-metrics-python36.logs +++ b/tests/integration/snapshots/sync-metrics-python36.logs @@ -1,7 +1,6 @@ START RequestId: XXXX Version: $LATEST {"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics-python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Kwargs: {'headers': {'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2'}, 'params': {'api_key': 'XXXX'}, 'data': '{"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]}', 'timeout': 60, 'proxies': None, 'verify': True} -HTTP POST /api/v1/distribution_points?api_key=XXXX Kwargs: {'body': '{"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]}', 'headers': {'User-Agent': 'python-requests/2.23.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2', 'Content-Length': '460'}} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/sync-metrics-python37.logs b/tests/integration/snapshots/sync-metrics-python37.logs index 701b36b0..a036c773 100644 --- a/tests/integration/snapshots/sync-metrics-python37.logs +++ b/tests/integration/snapshots/sync-metrics-python37.logs @@ -1,10 +1,6 @@ -HTTP GET /2018-06-01/runtime/invocation/XXXX Kwargs: {'headers': {'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '-1'}} START RequestId: XXXX Version: $LATEST {"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics-python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Kwargs: {'headers': {'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2'}, 'params': {'api_key': 'XXXX'}, 'data': '{"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]}', 'timeout': 60, 'proxies': None, 'verify': True} -HTTP POST /api/v1/distribution_points?api_key=XXXX Kwargs: {'body': '{"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]}', 'headers': {'User-Agent': 'python-requests/2.23.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2', 'Content-Length': '460'}} -HTTP POST /2018-06-01/runtime/invocation/XXXX/response {"statusCode": 200, "body": "hello, dog!"} Kwargs: {'headers': {'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2'}} -HTTP GET /2018-06-01/runtime/invocation/XXXX Kwargs: {'headers': {'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2'}} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/sync-metrics-python38.logs b/tests/integration/snapshots/sync-metrics-python38.logs index 59deaf67..e23f01d4 100644 --- a/tests/integration/snapshots/sync-metrics-python38.logs +++ b/tests/integration/snapshots/sync-metrics-python38.logs @@ -1,7 +1,6 @@ START RequestId: XXXX Version: $LATEST {"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics-python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Kwargs: {'headers': {'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2'}, 'params': {'api_key': 'XXXX'}, 'data': '{"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]}', 'timeout': 60, 'proxies': None, 'verify': True} -HTTP POST /api/v1/distribution_points?api_key=XXXX Kwargs: {'body': '{"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]}', 'headers': {'User-Agent': 'python-requests/2.23.0', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'x-datadog-trace-id': 'XXXX', 'x-datadog-parent-id': 'XXXX', 'x-datadog-sampling-priority': '2', 'Content-Length': '460'}} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true From 7b900f00f7f18b6a4f93f5d7f72bee652fdd2c91 Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Fri, 28 Feb 2020 13:09:38 -0500 Subject: [PATCH 07/19] Fix formatting --- datadog_lambda/patch.py | 1 - 1 file changed, 1 deletion(-) diff --git a/datadog_lambda/patch.py b/datadog_lambda/patch.py index a27282de..98dc143a 100644 --- a/datadog_lambda/patch.py +++ b/datadog_lambda/patch.py @@ -132,4 +132,3 @@ def _print_request_string(args, kwargs): method, url, sorted_header_str, sorted_data ) ) - From 583bd56912f9367cf4b310657c78e321c6e02d8b Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Mon, 9 Mar 2020 16:11:55 -0400 Subject: [PATCH 08/19] Readability tweaks for shell script --- scripts/run_integration_tests.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index 7fd9207b..bc832d61 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -1,6 +1,11 @@ #!/bin/bash -# Stop execution if any command has errors +# Usage: +# To check if new changes to the layer cause changes to any snapshots: +# BUILD_LAYERS=true DD_API_KEY=XXXX aws-vault exec sandbox-account-admin -- ./scripts/run_integration_tests +# To regenerate snapshots: +# UPDATE_SNAPSHOTS=true DD_API_KEY=XXXX aws-vault exec sandbox-account-admin -- ./scripts/run_integration_tests + set -e # These values need to be in sync with serverless.yml, where there needs to be a function @@ -21,15 +26,15 @@ mismatch_found=false echo "Start time is $script_start_time" -if [ -n "$UPDATE_SNAPSHOTS" ]; then - echo "Overwriting snapshots in this execution" -fi - if [ -z "$DD_API_KEY" ]; then echo "No DD_API_KEY env var set, exiting" exit 1 fi +if [ -n "$UPDATE_SNAPSHOTS" ]; then + echo "Overwriting snapshots in this execution" +fi + if [ -n "$BUILD_LAYERS" ]; then echo "Building layers that will be deployed with our test functions" source $scripts_dir/build_layers.sh @@ -42,7 +47,7 @@ cd $integration_tests_dir serverless deploy echo "Invoking functions" -set +e # Don't exit this script if an invocation fails +set +e # Don't immediately exit this script if an invocation fails or there's a diff for handler_name in "${LAMBDA_HANDLERS[@]}"; do for runtime in "${RUNTIMES[@]}"; do function_name="$handler_name-$runtime" @@ -52,6 +57,7 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do if [ -n "$UPDATE_SNAPSHOTS" ] || [ ! -f $function_snapshot_path ]; then # If $UPDATE_SNAPSHOTS is set to true, write the new logs over the current snapshot + # If the snapshot file doesn't exist yet, we create it echo "Writing return value snapshot for $function_name" echo "$return_value" >$function_snapshot_path else @@ -67,7 +73,6 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do fi done done - set -e echo "Sleeping $LOGS_WAIT_SECONDS seconds to wait for logs to appear in CloudWatch..." From db7ec15b3f8349cad0e6710231edb55bd6a907dd Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Mon, 9 Mar 2020 17:24:02 -0400 Subject: [PATCH 09/19] Refactor sed calls for better readability --- scripts/run_integration_tests.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index bc832d61..5f6b2bdb 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -2,9 +2,9 @@ # Usage: # To check if new changes to the layer cause changes to any snapshots: -# BUILD_LAYERS=true DD_API_KEY=XXXX aws-vault exec sandbox-account-admin -- ./scripts/run_integration_tests +# BUILD_LAYERS=true DD_API_KEY=XXXX aws-vault exec sandbox-account-admin -- ./scripts/run_integration_tests # To regenerate snapshots: -# UPDATE_SNAPSHOTS=true DD_API_KEY=XXXX aws-vault exec sandbox-account-admin -- ./scripts/run_integration_tests +# UPDATE_SNAPSHOTS=true DD_API_KEY=XXXX aws-vault exec sandbox-account-admin -- ./scripts/run_integration_tests set -e @@ -85,22 +85,22 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do function_snapshot_path="./snapshots/$function_name.logs" # Fetch logs with serverless cli - logs=$(serverless logs -f $function_name --startTime $script_start_time) - - # Filter serverless cli errors - logs=$(echo "$logs" | sed '/Serverless: Recoverable error occurred/d') + raw_logs=$(serverless logs -f $function_name --startTime $script_start_time) # Replace invocation-specific data like timestamps and IDs with XXXX to normalize logs across executions - # Normalize Lambda runtime report logs - logs=$(echo "$logs" | sed -E 's/(RequestId|TraceId|SegmentId|Duration|Memory Used|"e"): [a-z0-9\.\-]+/\1: XXXX/g') - # Normalize DD APM headers - logs=$(echo "$logs" | sed -E "s/(x-datadog-parent-id:|x-datadog-trace-id:)[0-9]+/\1XXXX/g") - # Normalize timestamps in datapoints POSTed to DD - logs=$(echo "$logs" | sed -E 's/"points": \[\[[0-9\.]+,/"points": \[\[XXXX,/g') - # # Normalize invocation IDs used in requests to the Lambda runtime - # logs=$(echo "$logs" | sed -E 's/\/2018-06-01\/runtime\/invocation\/[a-z0-9-]+/\/2018-06-01\/runtime\/invocation\/XXXX/g') - # Strip API key from logged requests - logs=$(echo "$logs" | sed -E "s/(api_key=|'api_key': ')[a-z0-9\.\-]+/\1XXXX/g") + logs=$( + echo "$raw_logs" | + # Filter serverless cli errors + sed '/Serverless: Recoverable error occurred/d' | + # Normalize Lambda runtime report logs + sed -E 's/(RequestId|TraceId|SegmentId|Duration|Memory Used|"e"): [a-z0-9\.\-]+/\1: XXXX/g' | + # Normalize DD APM headers + sed -E "s/(x-datadog-parent-id:|x-datadog-trace-id:)[0-9]+/\1XXXX/g" | + # Normalize timestamps in datapoints POSTed to DD + sed -E 's/"points": \[\[[0-9\.]+,/"points": \[\[XXXX,/g' | + # Strip API key from logged requests + sed -E "s/(api_key=|'api_key': ')[a-z0-9\.\-]+/\1XXXX/g" + ) if [ -n "$UPDATE_SNAPSHOTS" ] || [ ! -f $function_snapshot_path ]; then # If $UPDATE_SNAPSHOTS is set to true write the new logs over the current snapshot From 68f47eeb452086fba571d3302194e5c3706a2448 Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Mon, 9 Mar 2020 17:25:53 -0400 Subject: [PATCH 10/19] Remove accidental file --- tests/integration/date | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tests/integration/date diff --git a/tests/integration/date b/tests/integration/date deleted file mode 100644 index e69de29b..00000000 From bf82854efd3247b052e360ed5ff3b726bfb48be8 Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Mon, 9 Mar 2020 17:47:52 -0400 Subject: [PATCH 11/19] Rename functions to format handler-name_runtime --- scripts/run_integration_tests.sh | 4 ++-- tests/integration/serverless.yml | 24 +++++++++---------- ...hon27.logs => async-metrics_python27.logs} | 2 +- ...ue => async-metrics_python27.return_value} | 0 ...hon36.logs => async-metrics_python36.logs} | 2 +- ...ue => async-metrics_python36.return_value} | 0 ...hon37.logs => async-metrics_python37.logs} | 2 +- ...ue => async-metrics_python37.return_value} | 0 ...hon38.logs => async-metrics_python38.logs} | 2 +- ...ue => async-metrics_python38.return_value} | 0 ...hon27.logs => http-requests_python27.logs} | 2 +- ...ue => http-requests_python27.return_value} | 0 ...hon36.logs => http-requests_python36.logs} | 2 +- ...ue => http-requests_python36.return_value} | 0 ...hon37.logs => http-requests_python37.logs} | 2 +- ...ue => http-requests_python37.return_value} | 0 ...hon38.logs => http-requests_python38.logs} | 2 +- ...ue => http-requests_python38.return_value} | 0 ...thon27.logs => sync-metrics_python27.logs} | 2 +- ...lue => sync-metrics_python27.return_value} | 0 ...thon36.logs => sync-metrics_python36.logs} | 2 +- ...lue => sync-metrics_python36.return_value} | 0 ...thon37.logs => sync-metrics_python37.logs} | 2 +- ...lue => sync-metrics_python37.return_value} | 0 ...thon38.logs => sync-metrics_python38.logs} | 2 +- ...lue => sync-metrics_python38.return_value} | 0 26 files changed, 26 insertions(+), 26 deletions(-) rename tests/integration/snapshots/{async-metrics-python27.logs => async-metrics_python27.logs} (91%) rename tests/integration/snapshots/{async-metrics-python27.return_value => async-metrics_python27.return_value} (100%) rename tests/integration/snapshots/{async-metrics-python36.logs => async-metrics_python36.logs} (91%) rename tests/integration/snapshots/{async-metrics-python36.return_value => async-metrics_python36.return_value} (100%) rename tests/integration/snapshots/{async-metrics-python37.logs => async-metrics_python37.logs} (91%) rename tests/integration/snapshots/{async-metrics-python37.return_value => async-metrics_python37.return_value} (100%) rename tests/integration/snapshots/{async-metrics-python38.logs => async-metrics_python38.logs} (91%) rename tests/integration/snapshots/{async-metrics-python38.return_value => async-metrics_python38.return_value} (100%) rename tests/integration/snapshots/{http-requests-python27.logs => http-requests_python27.logs} (95%) rename tests/integration/snapshots/{http-requests-python27.return_value => http-requests_python27.return_value} (100%) rename tests/integration/snapshots/{http-requests-python36.logs => http-requests_python36.logs} (95%) rename tests/integration/snapshots/{http-requests-python36.return_value => http-requests_python36.return_value} (100%) rename tests/integration/snapshots/{http-requests-python37.logs => http-requests_python37.logs} (95%) rename tests/integration/snapshots/{http-requests-python37.return_value => http-requests_python37.return_value} (100%) rename tests/integration/snapshots/{http-requests-python38.logs => http-requests_python38.logs} (95%) rename tests/integration/snapshots/{http-requests-python38.return_value => http-requests_python38.return_value} (100%) rename tests/integration/snapshots/{sync-metrics-python27.logs => sync-metrics_python27.logs} (94%) rename tests/integration/snapshots/{sync-metrics-python27.return_value => sync-metrics_python27.return_value} (100%) rename tests/integration/snapshots/{sync-metrics-python36.logs => sync-metrics_python36.logs} (94%) rename tests/integration/snapshots/{sync-metrics-python36.return_value => sync-metrics_python36.return_value} (100%) rename tests/integration/snapshots/{sync-metrics-python37.logs => sync-metrics_python37.logs} (94%) rename tests/integration/snapshots/{sync-metrics-python37.return_value => sync-metrics_python37.return_value} (100%) rename tests/integration/snapshots/{sync-metrics-python38.logs => sync-metrics_python38.logs} (94%) rename tests/integration/snapshots/{sync-metrics-python38.return_value => sync-metrics_python38.return_value} (100%) diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index 5f6b2bdb..55cae702 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -50,7 +50,7 @@ echo "Invoking functions" set +e # Don't immediately exit this script if an invocation fails or there's a diff for handler_name in "${LAMBDA_HANDLERS[@]}"; do for runtime in "${RUNTIMES[@]}"; do - function_name="$handler_name-$runtime" + function_name="${handler_name}_${runtime}" function_snapshot_path="./snapshots/$function_name.return_value" return_value=$(serverless invoke -f $function_name) @@ -81,7 +81,7 @@ sleep $LOGS_WAIT_SECONDS echo "Fetching logs for invocations and comparing to snapshots" for handler_name in "${LAMBDA_HANDLERS[@]}"; do for runtime in "${RUNTIMES[@]}"; do - function_name="$handler_name-$runtime" + function_name="${handler_name}_${runtime}" function_snapshot_path="./snapshots/$function_name.logs" # Fetch logs with serverless cli diff --git a/tests/integration/serverless.yml b/tests/integration/serverless.yml index 0b769a94..b4422c50 100644 --- a/tests/integration/serverless.yml +++ b/tests/integration/serverless.yml @@ -25,7 +25,7 @@ layers: functions: # async-metrics - async-metrics-python27: + async-metrics_python27: handler: handle.handle runtime: python2.7 layers: @@ -33,7 +33,7 @@ functions: environment: DD_FLUSH_TO_LOG: true - async-metrics-python36: + async-metrics_python36: handler: handle.handle runtime: python3.6 layers: @@ -41,7 +41,7 @@ functions: environment: DD_FLUSH_TO_LOG: true - async-metrics-python37: + async-metrics_python37: handler: handle.handle runtime: python3.7 layers: @@ -49,7 +49,7 @@ functions: environment: DD_FLUSH_TO_LOG: true - async-metrics-python38: + async-metrics_python38: handler: handle.handle runtime: python3.8 layers: @@ -58,50 +58,50 @@ functions: DD_FLUSH_TO_LOG: true # sync-metrics - sync-metrics-python27: + sync-metrics_python27: handler: handle.handle runtime: python2.7 layers: - { Ref: Python27LambdaLayer } - sync-metrics-python36: + sync-metrics_python36: handler: handle.handle runtime: python3.6 layers: - { Ref: Python36LambdaLayer } - sync-metrics-python37: + sync-metrics_python37: handler: handle.handle runtime: python3.7 layers: - { Ref: Python37LambdaLayer } - sync-metrics-python38: + sync-metrics_python38: handler: handle.handle runtime: python3.8 layers: - { Ref: Python38LambdaLayer } # http-requests - http-requests-python27: + http-requests_python27: handler: http_requests.handle runtime: python2.7 layers: - { Ref: Python27LambdaLayer } - http-requests-python36: + http-requests_python36: handler: http_requests.handle runtime: python3.6 layers: - { Ref: Python36LambdaLayer } - http-requests-python37: + http-requests_python37: handler: http_requests.handle runtime: python3.7 layers: - { Ref: Python37LambdaLayer } - http-requests-python38: + http-requests_python38: handler: http_requests.handle runtime: python3.8 layers: diff --git a/tests/integration/snapshots/async-metrics-python27.logs b/tests/integration/snapshots/async-metrics_python27.logs similarity index 91% rename from tests/integration/snapshots/async-metrics-python27.logs rename to tests/integration/snapshots/async-metrics_python27.logs index e11863c4..109e8238 100644 --- a/tests/integration/snapshots/async-metrics-python27.logs +++ b/tests/integration/snapshots/async-metrics_python27.logs @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} {"e": XXXX, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} {"e": XXXX, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 21} END RequestId: XXXX diff --git a/tests/integration/snapshots/async-metrics-python27.return_value b/tests/integration/snapshots/async-metrics_python27.return_value similarity index 100% rename from tests/integration/snapshots/async-metrics-python27.return_value rename to tests/integration/snapshots/async-metrics_python27.return_value diff --git a/tests/integration/snapshots/async-metrics-python36.logs b/tests/integration/snapshots/async-metrics_python36.logs similarity index 91% rename from tests/integration/snapshots/async-metrics-python36.logs rename to tests/integration/snapshots/async-metrics_python36.logs index 983942a8..f756b3d1 100644 --- a/tests/integration/snapshots/async-metrics-python36.logs +++ b/tests/integration/snapshots/async-metrics_python36.logs @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} {"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} {"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} END RequestId: XXXX diff --git a/tests/integration/snapshots/async-metrics-python36.return_value b/tests/integration/snapshots/async-metrics_python36.return_value similarity index 100% rename from tests/integration/snapshots/async-metrics-python36.return_value rename to tests/integration/snapshots/async-metrics_python36.return_value diff --git a/tests/integration/snapshots/async-metrics-python37.logs b/tests/integration/snapshots/async-metrics_python37.logs similarity index 91% rename from tests/integration/snapshots/async-metrics-python37.logs rename to tests/integration/snapshots/async-metrics_python37.logs index 4da1062b..66448508 100644 --- a/tests/integration/snapshots/async-metrics-python37.logs +++ b/tests/integration/snapshots/async-metrics_python37.logs @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} {"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} {"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} END RequestId: XXXX diff --git a/tests/integration/snapshots/async-metrics-python37.return_value b/tests/integration/snapshots/async-metrics_python37.return_value similarity index 100% rename from tests/integration/snapshots/async-metrics-python37.return_value rename to tests/integration/snapshots/async-metrics_python37.return_value diff --git a/tests/integration/snapshots/async-metrics-python38.logs b/tests/integration/snapshots/async-metrics_python38.logs similarity index 91% rename from tests/integration/snapshots/async-metrics-python38.logs rename to tests/integration/snapshots/async-metrics_python38.logs index 8d9a6ad2..e3c8fc63 100644 --- a/tests/integration/snapshots/async-metrics-python38.logs +++ b/tests/integration/snapshots/async-metrics_python38.logs @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics-python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} {"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} {"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} END RequestId: XXXX diff --git a/tests/integration/snapshots/async-metrics-python38.return_value b/tests/integration/snapshots/async-metrics_python38.return_value similarity index 100% rename from tests/integration/snapshots/async-metrics-python38.return_value rename to tests/integration/snapshots/async-metrics_python38.return_value diff --git a/tests/integration/snapshots/http-requests-python27.logs b/tests/integration/snapshots/http-requests_python27.logs similarity index 95% rename from tests/integration/snapshots/http-requests-python27.logs rename to tests/integration/snapshots/http-requests_python27.logs index 0ba55066..0f6b2286 100644 --- a/tests/integration/snapshots/http-requests-python27.logs +++ b/tests/integration/snapshots/http-requests_python27.logs @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests-python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} diff --git a/tests/integration/snapshots/http-requests-python27.return_value b/tests/integration/snapshots/http-requests_python27.return_value similarity index 100% rename from tests/integration/snapshots/http-requests-python27.return_value rename to tests/integration/snapshots/http-requests_python27.return_value diff --git a/tests/integration/snapshots/http-requests-python36.logs b/tests/integration/snapshots/http-requests_python36.logs similarity index 95% rename from tests/integration/snapshots/http-requests-python36.logs rename to tests/integration/snapshots/http-requests_python36.logs index d180d881..596b8ba9 100644 --- a/tests/integration/snapshots/http-requests-python36.logs +++ b/tests/integration/snapshots/http-requests_python36.logs @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests-python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} diff --git a/tests/integration/snapshots/http-requests-python36.return_value b/tests/integration/snapshots/http-requests_python36.return_value similarity index 100% rename from tests/integration/snapshots/http-requests-python36.return_value rename to tests/integration/snapshots/http-requests_python36.return_value diff --git a/tests/integration/snapshots/http-requests-python37.logs b/tests/integration/snapshots/http-requests_python37.logs similarity index 95% rename from tests/integration/snapshots/http-requests-python37.logs rename to tests/integration/snapshots/http-requests_python37.logs index 6cf9c301..6916d8ac 100644 --- a/tests/integration/snapshots/http-requests-python37.logs +++ b/tests/integration/snapshots/http-requests_python37.logs @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests-python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} diff --git a/tests/integration/snapshots/http-requests-python37.return_value b/tests/integration/snapshots/http-requests_python37.return_value similarity index 100% rename from tests/integration/snapshots/http-requests-python37.return_value rename to tests/integration/snapshots/http-requests_python37.return_value diff --git a/tests/integration/snapshots/http-requests-python38.logs b/tests/integration/snapshots/http-requests_python38.logs similarity index 95% rename from tests/integration/snapshots/http-requests-python38.logs rename to tests/integration/snapshots/http-requests_python38.logs index 0c4a0016..ff33746d 100644 --- a/tests/integration/snapshots/http-requests-python38.logs +++ b/tests/integration/snapshots/http-requests_python38.logs @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests-python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} diff --git a/tests/integration/snapshots/http-requests-python38.return_value b/tests/integration/snapshots/http-requests_python38.return_value similarity index 100% rename from tests/integration/snapshots/http-requests-python38.return_value rename to tests/integration/snapshots/http-requests_python38.return_value diff --git a/tests/integration/snapshots/sync-metrics-python27.logs b/tests/integration/snapshots/sync-metrics_python27.logs similarity index 94% rename from tests/integration/snapshots/sync-metrics-python27.logs rename to tests/integration/snapshots/sync-metrics_python27.logs index e4735bdc..67a898e5 100644 --- a/tests/integration/snapshots/sync-metrics-python27.logs +++ b/tests/integration/snapshots/sync-metrics_python27.logs @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics-python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms diff --git a/tests/integration/snapshots/sync-metrics-python27.return_value b/tests/integration/snapshots/sync-metrics_python27.return_value similarity index 100% rename from tests/integration/snapshots/sync-metrics-python27.return_value rename to tests/integration/snapshots/sync-metrics_python27.return_value diff --git a/tests/integration/snapshots/sync-metrics-python36.logs b/tests/integration/snapshots/sync-metrics_python36.logs similarity index 94% rename from tests/integration/snapshots/sync-metrics-python36.logs rename to tests/integration/snapshots/sync-metrics_python36.logs index d32fcdf3..57bb01a0 100644 --- a/tests/integration/snapshots/sync-metrics-python36.logs +++ b/tests/integration/snapshots/sync-metrics_python36.logs @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics-python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms diff --git a/tests/integration/snapshots/sync-metrics-python36.return_value b/tests/integration/snapshots/sync-metrics_python36.return_value similarity index 100% rename from tests/integration/snapshots/sync-metrics-python36.return_value rename to tests/integration/snapshots/sync-metrics_python36.return_value diff --git a/tests/integration/snapshots/sync-metrics-python37.logs b/tests/integration/snapshots/sync-metrics_python37.logs similarity index 94% rename from tests/integration/snapshots/sync-metrics-python37.logs rename to tests/integration/snapshots/sync-metrics_python37.logs index a036c773..768dcf1b 100644 --- a/tests/integration/snapshots/sync-metrics-python37.logs +++ b/tests/integration/snapshots/sync-metrics_python37.logs @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics-python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms diff --git a/tests/integration/snapshots/sync-metrics-python37.return_value b/tests/integration/snapshots/sync-metrics_python37.return_value similarity index 100% rename from tests/integration/snapshots/sync-metrics-python37.return_value rename to tests/integration/snapshots/sync-metrics_python37.return_value diff --git a/tests/integration/snapshots/sync-metrics-python38.logs b/tests/integration/snapshots/sync-metrics_python38.logs similarity index 94% rename from tests/integration/snapshots/sync-metrics-python38.logs rename to tests/integration/snapshots/sync-metrics_python38.logs index e23f01d4..a62920a4 100644 --- a/tests/integration/snapshots/sync-metrics-python38.logs +++ b/tests/integration/snapshots/sync-metrics_python38.logs @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics-python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms diff --git a/tests/integration/snapshots/sync-metrics-python38.return_value b/tests/integration/snapshots/sync-metrics_python38.return_value similarity index 100% rename from tests/integration/snapshots/sync-metrics-python38.return_value rename to tests/integration/snapshots/sync-metrics_python38.return_value From 44c9d2aeb0385183b1a7152e84381baf3fc8e60f Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Tue, 10 Mar 2020 12:47:04 -0400 Subject: [PATCH 12/19] Restructure snapshots dir, add input events --- scripts/run_integration_tests.sh | 55 ++++++++++++------- .../input_events/api-gateway-get.json | 55 +++++++++++++++++++ tests/integration/input_events/sns.json | 31 +++++++++++ tests/integration/input_events/sqs.json | 36 ++++++++++++ .../snapshots/async-metrics_python27.logs | 7 --- .../snapshots/async-metrics_python36.logs | 7 --- .../snapshots/async-metrics_python37.logs | 7 --- .../snapshots/async-metrics_python38.logs | 7 --- .../snapshots/http-requests_python27.logs | 8 --- .../snapshots/http-requests_python36.logs | 8 --- .../snapshots/http-requests_python37.logs | 8 --- .../snapshots/http-requests_python38.logs | 8 --- .../snapshots/logs/async-metrics_python27.log | 21 +++++++ .../snapshots/logs/async-metrics_python36.log | 21 +++++++ .../snapshots/logs/async-metrics_python37.log | 21 +++++++ .../snapshots/logs/async-metrics_python38.log | 21 +++++++ .../snapshots/logs/http-requests_python27.log | 24 ++++++++ .../snapshots/logs/http-requests_python36.log | 24 ++++++++ .../snapshots/logs/http-requests_python37.log | 24 ++++++++ .../snapshots/logs/http-requests_python38.log | 24 ++++++++ .../snapshots/logs/sync-metrics_python27.log | 18 ++++++ .../snapshots/logs/sync-metrics_python36.log | 18 ++++++ .../snapshots/logs/sync-metrics_python37.log | 18 ++++++ .../snapshots/logs/sync-metrics_python38.log | 18 ++++++ ...ync-metrics_python27_api-gateway-get.json} | 0 .../async-metrics_python27_sns.json} | 0 .../async-metrics_python27_sqs.json} | 0 ...ync-metrics_python36_api-gateway-get.json} | 0 .../async-metrics_python36_sns.json} | 0 .../async-metrics_python36_sqs.json} | 0 ...ync-metrics_python37_api-gateway-get.json} | 0 .../async-metrics_python37_sns.json} | 0 .../async-metrics_python37_sqs.json} | 0 ...ync-metrics_python38_api-gateway-get.json} | 0 .../async-metrics_python38_sns.json} | 0 .../async-metrics_python38_sqs.json} | 0 ...ttp-requests_python27_api-gateway-get.json | 4 ++ .../http-requests_python27_sns.json | 4 ++ .../http-requests_python27_sqs.json | 4 ++ ...ttp-requests_python36_api-gateway-get.json | 4 ++ .../http-requests_python36_sns.json | 4 ++ .../http-requests_python36_sqs.json | 4 ++ ...ttp-requests_python37_api-gateway-get.json | 4 ++ .../http-requests_python37_sns.json | 4 ++ .../http-requests_python37_sqs.json | 4 ++ ...ttp-requests_python38_api-gateway-get.json | 4 ++ .../http-requests_python38_sns.json | 4 ++ .../http-requests_python38_sqs.json | 4 ++ ...sync-metrics_python27_api-gateway-get.json | 4 ++ .../sync-metrics_python27_sns.json | 4 ++ .../sync-metrics_python27_sqs.json | 4 ++ ...sync-metrics_python36_api-gateway-get.json | 4 ++ .../sync-metrics_python36_sns.json | 4 ++ .../sync-metrics_python36_sqs.json | 4 ++ ...sync-metrics_python37_api-gateway-get.json | 4 ++ .../sync-metrics_python37_sns.json | 4 ++ .../sync-metrics_python37_sqs.json | 4 ++ ...sync-metrics_python38_api-gateway-get.json | 4 ++ .../sync-metrics_python38_sns.json | 4 ++ .../sync-metrics_python38_sqs.json | 4 ++ .../snapshots/sync-metrics_python27.logs | 6 -- .../snapshots/sync-metrics_python36.logs | 6 -- .../snapshots/sync-metrics_python37.logs | 6 -- .../snapshots/sync-metrics_python38.logs | 6 -- 64 files changed, 505 insertions(+), 104 deletions(-) create mode 100644 tests/integration/input_events/api-gateway-get.json create mode 100644 tests/integration/input_events/sns.json create mode 100644 tests/integration/input_events/sqs.json delete mode 100644 tests/integration/snapshots/async-metrics_python27.logs delete mode 100644 tests/integration/snapshots/async-metrics_python36.logs delete mode 100644 tests/integration/snapshots/async-metrics_python37.logs delete mode 100644 tests/integration/snapshots/async-metrics_python38.logs delete mode 100644 tests/integration/snapshots/http-requests_python27.logs delete mode 100644 tests/integration/snapshots/http-requests_python36.logs delete mode 100644 tests/integration/snapshots/http-requests_python37.logs delete mode 100644 tests/integration/snapshots/http-requests_python38.logs create mode 100644 tests/integration/snapshots/logs/async-metrics_python27.log create mode 100644 tests/integration/snapshots/logs/async-metrics_python36.log create mode 100644 tests/integration/snapshots/logs/async-metrics_python37.log create mode 100644 tests/integration/snapshots/logs/async-metrics_python38.log create mode 100644 tests/integration/snapshots/logs/http-requests_python27.log create mode 100644 tests/integration/snapshots/logs/http-requests_python36.log create mode 100644 tests/integration/snapshots/logs/http-requests_python37.log create mode 100644 tests/integration/snapshots/logs/http-requests_python38.log create mode 100644 tests/integration/snapshots/logs/sync-metrics_python27.log create mode 100644 tests/integration/snapshots/logs/sync-metrics_python36.log create mode 100644 tests/integration/snapshots/logs/sync-metrics_python37.log create mode 100644 tests/integration/snapshots/logs/sync-metrics_python38.log rename tests/integration/snapshots/{async-metrics_python27.return_value => return_values/async-metrics_python27_api-gateway-get.json} (100%) rename tests/integration/snapshots/{http-requests_python27.return_value => return_values/async-metrics_python27_sns.json} (100%) rename tests/integration/snapshots/{sync-metrics_python27.return_value => return_values/async-metrics_python27_sqs.json} (100%) rename tests/integration/snapshots/{async-metrics_python36.return_value => return_values/async-metrics_python36_api-gateway-get.json} (100%) rename tests/integration/snapshots/{async-metrics_python37.return_value => return_values/async-metrics_python36_sns.json} (100%) rename tests/integration/snapshots/{async-metrics_python38.return_value => return_values/async-metrics_python36_sqs.json} (100%) rename tests/integration/snapshots/{http-requests_python36.return_value => return_values/async-metrics_python37_api-gateway-get.json} (100%) rename tests/integration/snapshots/{http-requests_python37.return_value => return_values/async-metrics_python37_sns.json} (100%) rename tests/integration/snapshots/{http-requests_python38.return_value => return_values/async-metrics_python37_sqs.json} (100%) rename tests/integration/snapshots/{sync-metrics_python36.return_value => return_values/async-metrics_python38_api-gateway-get.json} (100%) rename tests/integration/snapshots/{sync-metrics_python37.return_value => return_values/async-metrics_python38_sns.json} (100%) rename tests/integration/snapshots/{sync-metrics_python38.return_value => return_values/async-metrics_python38_sqs.json} (100%) create mode 100644 tests/integration/snapshots/return_values/http-requests_python27_api-gateway-get.json create mode 100644 tests/integration/snapshots/return_values/http-requests_python27_sns.json create mode 100644 tests/integration/snapshots/return_values/http-requests_python27_sqs.json create mode 100644 tests/integration/snapshots/return_values/http-requests_python36_api-gateway-get.json create mode 100644 tests/integration/snapshots/return_values/http-requests_python36_sns.json create mode 100644 tests/integration/snapshots/return_values/http-requests_python36_sqs.json create mode 100644 tests/integration/snapshots/return_values/http-requests_python37_api-gateway-get.json create mode 100644 tests/integration/snapshots/return_values/http-requests_python37_sns.json create mode 100644 tests/integration/snapshots/return_values/http-requests_python37_sqs.json create mode 100644 tests/integration/snapshots/return_values/http-requests_python38_api-gateway-get.json create mode 100644 tests/integration/snapshots/return_values/http-requests_python38_sns.json create mode 100644 tests/integration/snapshots/return_values/http-requests_python38_sqs.json create mode 100644 tests/integration/snapshots/return_values/sync-metrics_python27_api-gateway-get.json create mode 100644 tests/integration/snapshots/return_values/sync-metrics_python27_sns.json create mode 100644 tests/integration/snapshots/return_values/sync-metrics_python27_sqs.json create mode 100644 tests/integration/snapshots/return_values/sync-metrics_python36_api-gateway-get.json create mode 100644 tests/integration/snapshots/return_values/sync-metrics_python36_sns.json create mode 100644 tests/integration/snapshots/return_values/sync-metrics_python36_sqs.json create mode 100644 tests/integration/snapshots/return_values/sync-metrics_python37_api-gateway-get.json create mode 100644 tests/integration/snapshots/return_values/sync-metrics_python37_sns.json create mode 100644 tests/integration/snapshots/return_values/sync-metrics_python37_sqs.json create mode 100644 tests/integration/snapshots/return_values/sync-metrics_python38_api-gateway-get.json create mode 100644 tests/integration/snapshots/return_values/sync-metrics_python38_sns.json create mode 100644 tests/integration/snapshots/return_values/sync-metrics_python38_sqs.json delete mode 100644 tests/integration/snapshots/sync-metrics_python27.logs delete mode 100644 tests/integration/snapshots/sync-metrics_python36.logs delete mode 100644 tests/integration/snapshots/sync-metrics_python37.logs delete mode 100644 tests/integration/snapshots/sync-metrics_python38.logs diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index 55cae702..bb6bacb1 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -42,8 +42,12 @@ else echo "Not building layers, ensure they've already been built or re-run with 'REBUILD_LAYERS=true ./scripts/run_integration_tests.sh'" fi -echo "Deploying functions" cd $integration_tests_dir +input_event_files=$(ls ./input_events) +# Sort events by name so that snapshots stay consistent +input_event_files=($(for file_name in ${input_event_files[@]}; do echo $file_name; done | sort)) + +echo "Deploying functions" serverless deploy echo "Invoking functions" @@ -51,27 +55,36 @@ set +e # Don't immediately exit this script if an invocation fails or there's a for handler_name in "${LAMBDA_HANDLERS[@]}"; do for runtime in "${RUNTIMES[@]}"; do function_name="${handler_name}_${runtime}" - function_snapshot_path="./snapshots/$function_name.return_value" - - return_value=$(serverless invoke -f $function_name) - - if [ -n "$UPDATE_SNAPSHOTS" ] || [ ! -f $function_snapshot_path ]; then - # If $UPDATE_SNAPSHOTS is set to true, write the new logs over the current snapshot - # If the snapshot file doesn't exist yet, we create it - echo "Writing return value snapshot for $function_name" - echo "$return_value" >$function_snapshot_path - else - # Compare new return value to snapshot - diff_output=$(echo "$return_value" | diff - $function_snapshot_path) - if [ $? -eq 1 ]; then - echo "Failed: Return value for $function_name does not match snapshot:" - echo "$diff_output" - mismatch_found=true + # Invoke function once for each input event + for input_event_file in "${input_event_files[@]}"; do + echo "input_event_file=$input_event_file" + # Get event name without trailing ".json" so we can build the snapshot name + input_event_name=$(echo "$input_event_file" | sed "s/.json//") + # Return value snapshot file format is snapshots/return_values/{handler}_{runtime}_{input-event} + snapshot_path="./snapshots/return_values/${function_name}_${input_event_name}.json" + + return_value=$(serverless invoke -f $function_name --path "./input_events/$input_event_file") + + if [ -n "$UPDATE_SNAPSHOTS" ] || [ ! -f $snapshot_path ]; then + # If $UPDATE_SNAPSHOTS is set to true, write the new logs over the current snapshot + # If the snapshot file doesn't exist yet, we create it + echo "Writing return value snapshot for $snapshot_path" + echo "$return_value" >$snapshot_path else - echo "Ok: Return value for $function_name matches snapshot" + # Compare new return value to snapshot + diff_output=$(echo "$return_value" | diff - $snapshot_path) + if [ $? -eq 1 ]; then + echo "Failed: Return value for $function_name does not match snapshot:" + echo "$diff_output" + mismatch_found=true + else + echo "Ok: Return value for $function_name matches snapshot" + fi fi - fi + done + done + done set -e @@ -82,7 +95,7 @@ echo "Fetching logs for invocations and comparing to snapshots" for handler_name in "${LAMBDA_HANDLERS[@]}"; do for runtime in "${RUNTIMES[@]}"; do function_name="${handler_name}_${runtime}" - function_snapshot_path="./snapshots/$function_name.logs" + function_snapshot_path="./snapshots/logs/$function_name.log" # Fetch logs with serverless cli raw_logs=$(serverless logs -f $function_name --startTime $script_start_time) @@ -92,6 +105,8 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do echo "$raw_logs" | # Filter serverless cli errors sed '/Serverless: Recoverable error occurred/d' | + # Remove blank lines + sed '/^$/d' | # Normalize Lambda runtime report logs sed -E 's/(RequestId|TraceId|SegmentId|Duration|Memory Used|"e"): [a-z0-9\.\-]+/\1: XXXX/g' | # Normalize DD APM headers diff --git a/tests/integration/input_events/api-gateway-get.json b/tests/integration/input_events/api-gateway-get.json new file mode 100644 index 00000000..496553de --- /dev/null +++ b/tests/integration/input_events/api-gateway-get.json @@ -0,0 +1,55 @@ +{ + "path": "/test/hello", + "headers": { + "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "Accept-Encoding": "gzip, deflate, lzma, sdch, br", + "Accept-Language": "en-US,en;q=0.8", + "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-Country": "US", + "Host": "wt6mne2s9k.execute-api.us-west-2.amazonaws.com", + "Upgrade-Insecure-Requests": "1", + "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36 OPR/39.0.2256.48", + "Via": "1.1 fb7cca60f0ecd82ce07790c9c5eef16c.cloudfront.net (CloudFront)", + "X-Amz-Cf-Id": "nBsWBOrSHMgnaROZJK1wGCZ9PcRcSpq_oSXZNQwQ10OTZL4cimZo3g==", + "X-Forwarded-For": "192.168.100.1, 192.168.1.1", + "X-Forwarded-Port": "443", + "X-Forwarded-Proto": "https" + }, + "pathParameters": { + "proxy": "hello" + }, + "requestContext": { + "accountId": "123456789012", + "resourceId": "us4z18", + "stage": "test", + "requestId": "41b45ea3-70b5-11e6-b7bd-69b5aaebc7d9", + "identity": { + "cognitoIdentityPoolId": "", + "accountId": "", + "cognitoIdentityId": "", + "caller": "", + "apiKey": "", + "sourceIp": "192.168.100.1", + "cognitoAuthenticationType": "", + "cognitoAuthenticationProvider": "", + "userArn": "", + "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36 OPR/39.0.2256.48", + "user": "" + }, + "resourcePath": "/{proxy+}", + "httpMethod": "GET", + "apiId": "wt6mne2s9k" + }, + "resource": "/{proxy+}", + "httpMethod": "GET", + "queryStringParameters": { + "name": "me" + }, + "stageVariables": { + "stageVarName": "stageVarValue" + } +} diff --git a/tests/integration/input_events/sns.json b/tests/integration/input_events/sns.json new file mode 100644 index 00000000..a96a2ee8 --- /dev/null +++ b/tests/integration/input_events/sns.json @@ -0,0 +1,31 @@ +{ + "Records": [ + { + "EventVersion": "1.0", + "EventSubscriptionArn": "arn:aws:sns:us-east-2:123456789012:sns-lambda:21be56ed-a058-49f5-8c98-aedd2564c486", + "EventSource": "aws:sns", + "Sns": { + "SignatureVersion": "1", + "Timestamp": "2019-01-02T12:45:07.000Z", + "Signature": "tcc6faL2yUC6dgZdmrwh1Y4cGa/ebXEkAi6RibDsvpi+tE/1+82j...65r==", + "SigningCertUrl": "https://sns.us-east-2.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-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-2:123456789012:test-lambda:21be56ed-a058-49f5-8c98-aedd2564c486", + "TopicArn": "arn:aws:sns:us-east-2:123456789012:sns-lambda", + "Subject": "TestInvoke" + } + } + ] +} diff --git a/tests/integration/input_events/sqs.json b/tests/integration/input_events/sqs.json new file mode 100644 index 00000000..140f9604 --- /dev/null +++ b/tests/integration/input_events/sqs.json @@ -0,0 +1,36 @@ +{ + "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" + }, + { + "messageId": "2e1424d4-f796-459a-8184-9c92662be6da", + "receiptHandle": "AQEBzWwaftRI0KuVm4tP+/7q1rGgNqicHq...", + "body": "Test message.", + "attributes": { + "ApproximateReceiveCount": "1", + "SentTimestamp": "1545082650636", + "SenderId": "AIDAIENQZJOLO23YVJ4VO", + "ApproximateFirstReceiveTimestamp": "1545082650649" + }, + "messageAttributes": {}, + "md5OfBody": "e4e68fb7bd0e697a0ae8f1bb342846b3", + "eventSource": "aws:sqs", + "eventSourceARN": "arn:aws:sqs:us-east-2:123456789012:my-queue", + "awsRegion": "us-east-2" + } + ] +} diff --git a/tests/integration/snapshots/async-metrics_python27.logs b/tests/integration/snapshots/async-metrics_python27.logs deleted file mode 100644 index 109e8238..00000000 --- a/tests/integration/snapshots/async-metrics_python27.logs +++ /dev/null @@ -1,7 +0,0 @@ -START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -{"e": XXXX, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -{"e": XXXX, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 21} -END RequestId: XXXX -REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms -XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/async-metrics_python36.logs b/tests/integration/snapshots/async-metrics_python36.logs deleted file mode 100644 index f756b3d1..00000000 --- a/tests/integration/snapshots/async-metrics_python36.logs +++ /dev/null @@ -1,7 +0,0 @@ -START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} -{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} -{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} -END RequestId: XXXX -REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms -XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/async-metrics_python37.logs b/tests/integration/snapshots/async-metrics_python37.logs deleted file mode 100644 index 66448508..00000000 --- a/tests/integration/snapshots/async-metrics_python37.logs +++ /dev/null @@ -1,7 +0,0 @@ -START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} -{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} -{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} -END RequestId: XXXX -REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms -XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/async-metrics_python38.logs b/tests/integration/snapshots/async-metrics_python38.logs deleted file mode 100644 index e3c8fc63..00000000 --- a/tests/integration/snapshots/async-metrics_python38.logs +++ /dev/null @@ -1,7 +0,0 @@ -START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} -{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} -{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} -END RequestId: XXXX -REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms -XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/http-requests_python27.logs b/tests/integration/snapshots/http-requests_python27.logs deleted file mode 100644 index 0f6b2286..00000000 --- a/tests/integration/snapshots/http-requests_python27.logs +++ /dev/null @@ -1,8 +0,0 @@ -START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} -END RequestId: XXXX -REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms -XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/http-requests_python36.logs b/tests/integration/snapshots/http-requests_python36.logs deleted file mode 100644 index 596b8ba9..00000000 --- a/tests/integration/snapshots/http-requests_python36.logs +++ /dev/null @@ -1,8 +0,0 @@ -START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} -HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} -END RequestId: XXXX -REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms -XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/http-requests_python37.logs b/tests/integration/snapshots/http-requests_python37.logs deleted file mode 100644 index 6916d8ac..00000000 --- a/tests/integration/snapshots/http-requests_python37.logs +++ /dev/null @@ -1,8 +0,0 @@ -START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} -HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} -END RequestId: XXXX -REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms -XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/http-requests_python38.logs b/tests/integration/snapshots/http-requests_python38.logs deleted file mode 100644 index ff33746d..00000000 --- a/tests/integration/snapshots/http-requests_python38.logs +++ /dev/null @@ -1,8 +0,0 @@ -START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} -HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} -END RequestId: XXXX -REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms -XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/async-metrics_python27.log b/tests/integration/snapshots/logs/async-metrics_python27.log new file mode 100644 index 00000000..faa6f6c1 --- /dev/null +++ b/tests/integration/snapshots/logs/async-metrics_python27.log @@ -0,0 +1,21 @@ +START RequestId: XXXX Version: $LATEST +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 21} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 21} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 21} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/async-metrics_python36.log b/tests/integration/snapshots/logs/async-metrics_python36.log new file mode 100644 index 00000000..825f4ae2 --- /dev/null +++ b/tests/integration/snapshots/logs/async-metrics_python36.log @@ -0,0 +1,21 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/async-metrics_python37.log b/tests/integration/snapshots/logs/async-metrics_python37.log new file mode 100644 index 00000000..2b5398c1 --- /dev/null +++ b/tests/integration/snapshots/logs/async-metrics_python37.log @@ -0,0 +1,21 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/async-metrics_python38.log b/tests/integration/snapshots/logs/async-metrics_python38.log new file mode 100644 index 00000000..e31623c1 --- /dev/null +++ b/tests/integration/snapshots/logs/async-metrics_python38.log @@ -0,0 +1,21 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/http-requests_python27.log b/tests/integration/snapshots/logs/http-requests_python27.log new file mode 100644 index 00000000..432e9d59 --- /dev/null +++ b/tests/integration/snapshots/logs/http-requests_python27.log @@ -0,0 +1,24 @@ +START RequestId: XXXX Version: $LATEST +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/http-requests_python36.log b/tests/integration/snapshots/logs/http-requests_python36.log new file mode 100644 index 00000000..3dc6f0de --- /dev/null +++ b/tests/integration/snapshots/logs/http-requests_python36.log @@ -0,0 +1,24 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/http-requests_python37.log b/tests/integration/snapshots/logs/http-requests_python37.log new file mode 100644 index 00000000..890fb8c5 --- /dev/null +++ b/tests/integration/snapshots/logs/http-requests_python37.log @@ -0,0 +1,24 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/http-requests_python38.log b/tests/integration/snapshots/logs/http-requests_python38.log new file mode 100644 index 00000000..a1284d8d --- /dev/null +++ b/tests/integration/snapshots/logs/http-requests_python38.log @@ -0,0 +1,24 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/sync-metrics_python27.log b/tests/integration/snapshots/logs/sync-metrics_python27.log new file mode 100644 index 00000000..7b9dde14 --- /dev/null +++ b/tests/integration/snapshots/logs/sync-metrics_python27.log @@ -0,0 +1,18 @@ +START RequestId: XXXX Version: $LATEST +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/sync-metrics_python36.log b/tests/integration/snapshots/logs/sync-metrics_python36.log new file mode 100644 index 00000000..b439b1d1 --- /dev/null +++ b/tests/integration/snapshots/logs/sync-metrics_python36.log @@ -0,0 +1,18 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/sync-metrics_python37.log b/tests/integration/snapshots/logs/sync-metrics_python37.log new file mode 100644 index 00000000..dd7679a3 --- /dev/null +++ b/tests/integration/snapshots/logs/sync-metrics_python37.log @@ -0,0 +1,18 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/sync-metrics_python38.log b/tests/integration/snapshots/logs/sync-metrics_python38.log new file mode 100644 index 00000000..1cc472b5 --- /dev/null +++ b/tests/integration/snapshots/logs/sync-metrics_python38.log @@ -0,0 +1,18 @@ +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true +START RequestId: XXXX Version: $LATEST +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} +END RequestId: XXXX +REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB +XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/async-metrics_python27.return_value b/tests/integration/snapshots/return_values/async-metrics_python27_api-gateway-get.json similarity index 100% rename from tests/integration/snapshots/async-metrics_python27.return_value rename to tests/integration/snapshots/return_values/async-metrics_python27_api-gateway-get.json diff --git a/tests/integration/snapshots/http-requests_python27.return_value b/tests/integration/snapshots/return_values/async-metrics_python27_sns.json similarity index 100% rename from tests/integration/snapshots/http-requests_python27.return_value rename to tests/integration/snapshots/return_values/async-metrics_python27_sns.json diff --git a/tests/integration/snapshots/sync-metrics_python27.return_value b/tests/integration/snapshots/return_values/async-metrics_python27_sqs.json similarity index 100% rename from tests/integration/snapshots/sync-metrics_python27.return_value rename to tests/integration/snapshots/return_values/async-metrics_python27_sqs.json diff --git a/tests/integration/snapshots/async-metrics_python36.return_value b/tests/integration/snapshots/return_values/async-metrics_python36_api-gateway-get.json similarity index 100% rename from tests/integration/snapshots/async-metrics_python36.return_value rename to tests/integration/snapshots/return_values/async-metrics_python36_api-gateway-get.json diff --git a/tests/integration/snapshots/async-metrics_python37.return_value b/tests/integration/snapshots/return_values/async-metrics_python36_sns.json similarity index 100% rename from tests/integration/snapshots/async-metrics_python37.return_value rename to tests/integration/snapshots/return_values/async-metrics_python36_sns.json diff --git a/tests/integration/snapshots/async-metrics_python38.return_value b/tests/integration/snapshots/return_values/async-metrics_python36_sqs.json similarity index 100% rename from tests/integration/snapshots/async-metrics_python38.return_value rename to tests/integration/snapshots/return_values/async-metrics_python36_sqs.json diff --git a/tests/integration/snapshots/http-requests_python36.return_value b/tests/integration/snapshots/return_values/async-metrics_python37_api-gateway-get.json similarity index 100% rename from tests/integration/snapshots/http-requests_python36.return_value rename to tests/integration/snapshots/return_values/async-metrics_python37_api-gateway-get.json diff --git a/tests/integration/snapshots/http-requests_python37.return_value b/tests/integration/snapshots/return_values/async-metrics_python37_sns.json similarity index 100% rename from tests/integration/snapshots/http-requests_python37.return_value rename to tests/integration/snapshots/return_values/async-metrics_python37_sns.json diff --git a/tests/integration/snapshots/http-requests_python38.return_value b/tests/integration/snapshots/return_values/async-metrics_python37_sqs.json similarity index 100% rename from tests/integration/snapshots/http-requests_python38.return_value rename to tests/integration/snapshots/return_values/async-metrics_python37_sqs.json diff --git a/tests/integration/snapshots/sync-metrics_python36.return_value b/tests/integration/snapshots/return_values/async-metrics_python38_api-gateway-get.json similarity index 100% rename from tests/integration/snapshots/sync-metrics_python36.return_value rename to tests/integration/snapshots/return_values/async-metrics_python38_api-gateway-get.json diff --git a/tests/integration/snapshots/sync-metrics_python37.return_value b/tests/integration/snapshots/return_values/async-metrics_python38_sns.json similarity index 100% rename from tests/integration/snapshots/sync-metrics_python37.return_value rename to tests/integration/snapshots/return_values/async-metrics_python38_sns.json diff --git a/tests/integration/snapshots/sync-metrics_python38.return_value b/tests/integration/snapshots/return_values/async-metrics_python38_sqs.json similarity index 100% rename from tests/integration/snapshots/sync-metrics_python38.return_value rename to tests/integration/snapshots/return_values/async-metrics_python38_sqs.json diff --git a/tests/integration/snapshots/return_values/http-requests_python27_api-gateway-get.json b/tests/integration/snapshots/return_values/http-requests_python27_api-gateway-get.json new file mode 100644 index 00000000..403ec11f --- /dev/null +++ b/tests/integration/snapshots/return_values/http-requests_python27_api-gateway-get.json @@ -0,0 +1,4 @@ +{ + "body": "hello, dog!", + "statusCode": 200 +} diff --git a/tests/integration/snapshots/return_values/http-requests_python27_sns.json b/tests/integration/snapshots/return_values/http-requests_python27_sns.json new file mode 100644 index 00000000..403ec11f --- /dev/null +++ b/tests/integration/snapshots/return_values/http-requests_python27_sns.json @@ -0,0 +1,4 @@ +{ + "body": "hello, dog!", + "statusCode": 200 +} diff --git a/tests/integration/snapshots/return_values/http-requests_python27_sqs.json b/tests/integration/snapshots/return_values/http-requests_python27_sqs.json new file mode 100644 index 00000000..403ec11f --- /dev/null +++ b/tests/integration/snapshots/return_values/http-requests_python27_sqs.json @@ -0,0 +1,4 @@ +{ + "body": "hello, dog!", + "statusCode": 200 +} diff --git a/tests/integration/snapshots/return_values/http-requests_python36_api-gateway-get.json b/tests/integration/snapshots/return_values/http-requests_python36_api-gateway-get.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/http-requests_python36_api-gateway-get.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/http-requests_python36_sns.json b/tests/integration/snapshots/return_values/http-requests_python36_sns.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/http-requests_python36_sns.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/http-requests_python36_sqs.json b/tests/integration/snapshots/return_values/http-requests_python36_sqs.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/http-requests_python36_sqs.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/http-requests_python37_api-gateway-get.json b/tests/integration/snapshots/return_values/http-requests_python37_api-gateway-get.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/http-requests_python37_api-gateway-get.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/http-requests_python37_sns.json b/tests/integration/snapshots/return_values/http-requests_python37_sns.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/http-requests_python37_sns.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/http-requests_python37_sqs.json b/tests/integration/snapshots/return_values/http-requests_python37_sqs.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/http-requests_python37_sqs.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/http-requests_python38_api-gateway-get.json b/tests/integration/snapshots/return_values/http-requests_python38_api-gateway-get.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/http-requests_python38_api-gateway-get.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/http-requests_python38_sns.json b/tests/integration/snapshots/return_values/http-requests_python38_sns.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/http-requests_python38_sns.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/http-requests_python38_sqs.json b/tests/integration/snapshots/return_values/http-requests_python38_sqs.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/http-requests_python38_sqs.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/sync-metrics_python27_api-gateway-get.json b/tests/integration/snapshots/return_values/sync-metrics_python27_api-gateway-get.json new file mode 100644 index 00000000..403ec11f --- /dev/null +++ b/tests/integration/snapshots/return_values/sync-metrics_python27_api-gateway-get.json @@ -0,0 +1,4 @@ +{ + "body": "hello, dog!", + "statusCode": 200 +} diff --git a/tests/integration/snapshots/return_values/sync-metrics_python27_sns.json b/tests/integration/snapshots/return_values/sync-metrics_python27_sns.json new file mode 100644 index 00000000..403ec11f --- /dev/null +++ b/tests/integration/snapshots/return_values/sync-metrics_python27_sns.json @@ -0,0 +1,4 @@ +{ + "body": "hello, dog!", + "statusCode": 200 +} diff --git a/tests/integration/snapshots/return_values/sync-metrics_python27_sqs.json b/tests/integration/snapshots/return_values/sync-metrics_python27_sqs.json new file mode 100644 index 00000000..403ec11f --- /dev/null +++ b/tests/integration/snapshots/return_values/sync-metrics_python27_sqs.json @@ -0,0 +1,4 @@ +{ + "body": "hello, dog!", + "statusCode": 200 +} diff --git a/tests/integration/snapshots/return_values/sync-metrics_python36_api-gateway-get.json b/tests/integration/snapshots/return_values/sync-metrics_python36_api-gateway-get.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/sync-metrics_python36_api-gateway-get.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/sync-metrics_python36_sns.json b/tests/integration/snapshots/return_values/sync-metrics_python36_sns.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/sync-metrics_python36_sns.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/sync-metrics_python36_sqs.json b/tests/integration/snapshots/return_values/sync-metrics_python36_sqs.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/sync-metrics_python36_sqs.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/sync-metrics_python37_api-gateway-get.json b/tests/integration/snapshots/return_values/sync-metrics_python37_api-gateway-get.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/sync-metrics_python37_api-gateway-get.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/sync-metrics_python37_sns.json b/tests/integration/snapshots/return_values/sync-metrics_python37_sns.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/sync-metrics_python37_sns.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/sync-metrics_python37_sqs.json b/tests/integration/snapshots/return_values/sync-metrics_python37_sqs.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/sync-metrics_python37_sqs.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/sync-metrics_python38_api-gateway-get.json b/tests/integration/snapshots/return_values/sync-metrics_python38_api-gateway-get.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/sync-metrics_python38_api-gateway-get.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/sync-metrics_python38_sns.json b/tests/integration/snapshots/return_values/sync-metrics_python38_sns.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/sync-metrics_python38_sns.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/return_values/sync-metrics_python38_sqs.json b/tests/integration/snapshots/return_values/sync-metrics_python38_sqs.json new file mode 100644 index 00000000..9af9d67b --- /dev/null +++ b/tests/integration/snapshots/return_values/sync-metrics_python38_sqs.json @@ -0,0 +1,4 @@ +{ + "statusCode": 200, + "body": "hello, dog!" +} diff --git a/tests/integration/snapshots/sync-metrics_python27.logs b/tests/integration/snapshots/sync-metrics_python27.logs deleted file mode 100644 index 67a898e5..00000000 --- a/tests/integration/snapshots/sync-metrics_python27.logs +++ /dev/null @@ -1,6 +0,0 @@ -START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} -END RequestId: XXXX -REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms -XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/sync-metrics_python36.logs b/tests/integration/snapshots/sync-metrics_python36.logs deleted file mode 100644 index 57bb01a0..00000000 --- a/tests/integration/snapshots/sync-metrics_python36.logs +++ /dev/null @@ -1,6 +0,0 @@ -START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} -END RequestId: XXXX -REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms -XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/sync-metrics_python37.logs b/tests/integration/snapshots/sync-metrics_python37.logs deleted file mode 100644 index 768dcf1b..00000000 --- a/tests/integration/snapshots/sync-metrics_python37.logs +++ /dev/null @@ -1,6 +0,0 @@ -START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} -END RequestId: XXXX -REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms -XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/sync-metrics_python38.logs b/tests/integration/snapshots/sync-metrics_python38.logs deleted file mode 100644 index a62920a4..00000000 --- a/tests/integration/snapshots/sync-metrics_python38.logs +++ /dev/null @@ -1,6 +0,0 @@ -START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} -END RequestId: XXXX -REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms -XRAY TraceId: XXXX SegmentId: XXXX Sampled: true From be881abd3fd4d5b80f325c7163ca2e399080c973 Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Tue, 10 Mar 2020 14:26:29 -0400 Subject: [PATCH 13/19] Edit script for readability --- scripts/run_integration_tests.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index bb6bacb1..82c689a4 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -57,8 +57,7 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do function_name="${handler_name}_${runtime}" # Invoke function once for each input event for input_event_file in "${input_event_files[@]}"; do - echo "input_event_file=$input_event_file" - # Get event name without trailing ".json" so we can build the snapshot name + # Get event name without trailing ".json" so we can build the snapshot file name input_event_name=$(echo "$input_event_file" | sed "s/.json//") # Return value snapshot file format is snapshots/return_values/{handler}_{runtime}_{input-event} snapshot_path="./snapshots/return_values/${function_name}_${input_event_name}.json" @@ -78,7 +77,7 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do echo "$diff_output" mismatch_found=true else - echo "Ok: Return value for $function_name matches snapshot" + echo "Ok: Return value for $function_name with $input_event_name event matches snapshot" fi fi done @@ -139,7 +138,8 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do done if [ "$mismatch_found" = true ]; then - echo "FAILURE: A mismatch between new data and a snapshot was found and printed above. If the change is expected, generate new snapshots by running 'UPDATE_SNAPSHOTS=true ./scripts/run_integration_tests.sh'" + echo "FAILURE: A mismatch between new data and a snapshot was found and printed above." + echo "If the change is expected, generate new snapshots by running 'UPDATE_SNAPSHOTS=true ./scripts/run_integration_tests.sh'" exit 1 fi From be6186f6c2ebaef1cffd2cd3b3071263028f9d5d Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Tue, 10 Mar 2020 15:07:20 -0400 Subject: [PATCH 14/19] Generate snapshots in script if they don't exist yet --- scripts/run_integration_tests.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index 82c689a4..19514037 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -9,7 +9,7 @@ set -e # These values need to be in sync with serverless.yml, where there needs to be a function -# defined for every handler-runtime combination +# defined for every handler_runtime combination LAMBDA_HANDLERS=("async-metrics" "sync-metrics" "http-requests") RUNTIMES=("python27" "python36" "python37" "python38") @@ -44,14 +44,14 @@ fi cd $integration_tests_dir input_event_files=$(ls ./input_events) -# Sort events by name so that snapshots stay consistent +# Sort event files by name so that snapshots stay consistent input_event_files=($(for file_name in ${input_event_files[@]}; do echo $file_name; done | sort)) echo "Deploying functions" serverless deploy echo "Invoking functions" -set +e # Don't immediately exit this script if an invocation fails or there's a diff +set +e # Don't exit this script if an invocation fails or there's a diff for handler_name in "${LAMBDA_HANDLERS[@]}"; do for runtime in "${RUNTIMES[@]}"; do function_name="${handler_name}_${runtime}" @@ -64,10 +64,13 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do return_value=$(serverless invoke -f $function_name --path "./input_events/$input_event_file") - if [ -n "$UPDATE_SNAPSHOTS" ] || [ ! -f $snapshot_path ]; then - # If $UPDATE_SNAPSHOTS is set to true, write the new logs over the current snapshot + if [ ! -f $snapshot_path ]; then # If the snapshot file doesn't exist yet, we create it - echo "Writing return value snapshot for $snapshot_path" + echo "Writing return value to $snapshot_path because no snapshot exists yet" + echo "$return_value" >$snapshot_path + elif [ -n "$UPDATE_SNAPSHOTS" ]; then + # If $UPDATE_SNAPSHOTS is set to true, write the new logs over the current snapshot + echo "Overwriting return value snapshot for $snapshot_path" echo "$return_value" >$snapshot_path else # Compare new return value to snapshot @@ -116,10 +119,13 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do sed -E "s/(api_key=|'api_key': ')[a-z0-9\.\-]+/\1XXXX/g" ) - if [ -n "$UPDATE_SNAPSHOTS" ] || [ ! -f $function_snapshot_path ]; then + if [ ! -f $function_snapshot_path ]; then + # If no snapshot file exists yet, we create one + echo "Writing logs to $function_snapshot_path because no snapshot exists yet" + echo "$logs" >$function_snapshot_path + elif [ -n "$UPDATE_SNAPSHOTS" ]; then # If $UPDATE_SNAPSHOTS is set to true write the new logs over the current snapshot - # If no file exists yet, we create one - echo "Writing log snapshot for $function_name" + echo "Overwriting log snapshot for $function_snapshot_path" echo "$logs" >$function_snapshot_path else # Compare new logs to snapshots From 041825b2fca92100df71a7fe677dee6c4ddf5b27 Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Tue, 10 Mar 2020 15:33:29 -0400 Subject: [PATCH 15/19] Parse data out of input events to include in responses --- scripts/run_integration_tests.sh | 2 -- tests/integration/handle.py | 23 ++++++++++++++++++- tests/integration/http_requests.py | 2 +- ...sync-metrics_python27_api-gateway-get.json | 6 ++++- .../async-metrics_python27_sns.json | 8 ++++++- .../async-metrics_python27_sqs.json | 9 +++++++- ...sync-metrics_python36_api-gateway-get.json | 6 ++++- .../async-metrics_python36_sns.json | 8 ++++++- .../async-metrics_python36_sqs.json | 9 +++++++- ...sync-metrics_python37_api-gateway-get.json | 6 ++++- .../async-metrics_python37_sns.json | 8 ++++++- .../async-metrics_python37_sqs.json | 9 +++++++- ...sync-metrics_python38_api-gateway-get.json | 6 ++++- .../async-metrics_python38_sns.json | 8 ++++++- .../async-metrics_python38_sqs.json | 9 +++++++- ...ttp-requests_python27_api-gateway-get.json | 4 +++- .../http-requests_python27_sns.json | 4 +++- .../http-requests_python27_sqs.json | 4 +++- ...ttp-requests_python36_api-gateway-get.json | 4 +++- .../http-requests_python36_sns.json | 4 +++- .../http-requests_python36_sqs.json | 4 +++- ...ttp-requests_python37_api-gateway-get.json | 4 +++- .../http-requests_python37_sns.json | 4 +++- .../http-requests_python37_sqs.json | 4 +++- ...ttp-requests_python38_api-gateway-get.json | 4 +++- .../http-requests_python38_sns.json | 4 +++- .../http-requests_python38_sqs.json | 4 +++- ...sync-metrics_python27_api-gateway-get.json | 6 ++++- .../sync-metrics_python27_sns.json | 8 ++++++- .../sync-metrics_python27_sqs.json | 9 +++++++- ...sync-metrics_python36_api-gateway-get.json | 6 ++++- .../sync-metrics_python36_sns.json | 8 ++++++- .../sync-metrics_python36_sqs.json | 9 +++++++- ...sync-metrics_python37_api-gateway-get.json | 6 ++++- .../sync-metrics_python37_sns.json | 8 ++++++- .../sync-metrics_python37_sqs.json | 9 +++++++- ...sync-metrics_python38_api-gateway-get.json | 6 ++++- .../sync-metrics_python38_sns.json | 8 ++++++- .../sync-metrics_python38_sqs.json | 9 +++++++- 39 files changed, 219 insertions(+), 40 deletions(-) diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index 19514037..e1dd400c 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -24,8 +24,6 @@ script_start_time=$(date --iso-8601=seconds) mismatch_found=false -echo "Start time is $script_start_time" - if [ -z "$DD_API_KEY" ]; then echo "No DD_API_KEY env var set, exiting" exit 1 diff --git a/tests/integration/handle.py b/tests/integration/handle.py index 1fa94cbd..067680c6 100644 --- a/tests/integration/handle.py +++ b/tests/integration/handle.py @@ -6,8 +6,29 @@ @datadog_lambda_wrapper def handle(event, context): + # Parse request ID and record ids out of the event to include in the response + request_id = event.get("requestContext", {}).get("requestId") + event_records = event.get("Records", []) + + record_ids = [] + for record in event_records: + # SQS + if record.get("messageId"): + record_ids.append(record["messageId"]) + # SNS + if record.get("Sns", {}).get("MessageId"): + record_ids.append(record["Sns"]["MessageId"]) + lambda_metric("hello.dog", 1, tags=["team:serverless", "role:hello"]) lambda_metric( "tests.integration.count", 21, tags=["test:integration", "role:hello"] ) - return {"statusCode": 200, "body": "hello, dog!"} + + return { + "statusCode": 200, + "body": { + "message": "hello, dog!", + "request_id": request_id, + "event_record_ids": record_ids, + }, + } diff --git a/tests/integration/http_requests.py b/tests/integration/http_requests.py index 3dabd09d..472de310 100644 --- a/tests/integration/http_requests.py +++ b/tests/integration/http_requests.py @@ -15,4 +15,4 @@ def handle(event, context): us_response = requests.get("https://ip-ranges.datadoghq.com/") eu_response = requests.get("https://ip-ranges.datadoghq.eu/") - return {"statusCode": 200, "body": "hello, dog!"} + return {"statusCode": 200, "body": {"message": "hello, dog!"}} diff --git a/tests/integration/snapshots/return_values/async-metrics_python27_api-gateway-get.json b/tests/integration/snapshots/return_values/async-metrics_python27_api-gateway-get.json index 403ec11f..d8e93bb0 100644 --- a/tests/integration/snapshots/return_values/async-metrics_python27_api-gateway-get.json +++ b/tests/integration/snapshots/return_values/async-metrics_python27_api-gateway-get.json @@ -1,4 +1,8 @@ { - "body": "hello, dog!", + "body": { + "message": "hello, dog!", + "event_record_ids": [], + "request_id": "41b45ea3-70b5-11e6-b7bd-69b5aaebc7d9" + }, "statusCode": 200 } diff --git a/tests/integration/snapshots/return_values/async-metrics_python27_sns.json b/tests/integration/snapshots/return_values/async-metrics_python27_sns.json index 403ec11f..08cbae60 100644 --- a/tests/integration/snapshots/return_values/async-metrics_python27_sns.json +++ b/tests/integration/snapshots/return_values/async-metrics_python27_sns.json @@ -1,4 +1,10 @@ { - "body": "hello, dog!", + "body": { + "message": "hello, dog!", + "event_record_ids": [ + "95df01b4-ee98-5cb9-9903-4c221d41eb5e" + ], + "request_id": null + }, "statusCode": 200 } diff --git a/tests/integration/snapshots/return_values/async-metrics_python27_sqs.json b/tests/integration/snapshots/return_values/async-metrics_python27_sqs.json index 403ec11f..03f2a6cd 100644 --- a/tests/integration/snapshots/return_values/async-metrics_python27_sqs.json +++ b/tests/integration/snapshots/return_values/async-metrics_python27_sqs.json @@ -1,4 +1,11 @@ { - "body": "hello, dog!", + "body": { + "message": "hello, dog!", + "event_record_ids": [ + "059f36b4-87a3-44ab-83d2-661975830a7d", + "2e1424d4-f796-459a-8184-9c92662be6da" + ], + "request_id": null + }, "statusCode": 200 } diff --git a/tests/integration/snapshots/return_values/async-metrics_python36_api-gateway-get.json b/tests/integration/snapshots/return_values/async-metrics_python36_api-gateway-get.json index 9af9d67b..22038093 100644 --- a/tests/integration/snapshots/return_values/async-metrics_python36_api-gateway-get.json +++ b/tests/integration/snapshots/return_values/async-metrics_python36_api-gateway-get.json @@ -1,4 +1,8 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": "41b45ea3-70b5-11e6-b7bd-69b5aaebc7d9", + "event_record_ids": [] + } } diff --git a/tests/integration/snapshots/return_values/async-metrics_python36_sns.json b/tests/integration/snapshots/return_values/async-metrics_python36_sns.json index 9af9d67b..e1f007e6 100644 --- a/tests/integration/snapshots/return_values/async-metrics_python36_sns.json +++ b/tests/integration/snapshots/return_values/async-metrics_python36_sns.json @@ -1,4 +1,10 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": null, + "event_record_ids": [ + "95df01b4-ee98-5cb9-9903-4c221d41eb5e" + ] + } } diff --git a/tests/integration/snapshots/return_values/async-metrics_python36_sqs.json b/tests/integration/snapshots/return_values/async-metrics_python36_sqs.json index 9af9d67b..970f7dff 100644 --- a/tests/integration/snapshots/return_values/async-metrics_python36_sqs.json +++ b/tests/integration/snapshots/return_values/async-metrics_python36_sqs.json @@ -1,4 +1,11 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": null, + "event_record_ids": [ + "059f36b4-87a3-44ab-83d2-661975830a7d", + "2e1424d4-f796-459a-8184-9c92662be6da" + ] + } } diff --git a/tests/integration/snapshots/return_values/async-metrics_python37_api-gateway-get.json b/tests/integration/snapshots/return_values/async-metrics_python37_api-gateway-get.json index 9af9d67b..22038093 100644 --- a/tests/integration/snapshots/return_values/async-metrics_python37_api-gateway-get.json +++ b/tests/integration/snapshots/return_values/async-metrics_python37_api-gateway-get.json @@ -1,4 +1,8 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": "41b45ea3-70b5-11e6-b7bd-69b5aaebc7d9", + "event_record_ids": [] + } } diff --git a/tests/integration/snapshots/return_values/async-metrics_python37_sns.json b/tests/integration/snapshots/return_values/async-metrics_python37_sns.json index 9af9d67b..e1f007e6 100644 --- a/tests/integration/snapshots/return_values/async-metrics_python37_sns.json +++ b/tests/integration/snapshots/return_values/async-metrics_python37_sns.json @@ -1,4 +1,10 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": null, + "event_record_ids": [ + "95df01b4-ee98-5cb9-9903-4c221d41eb5e" + ] + } } diff --git a/tests/integration/snapshots/return_values/async-metrics_python37_sqs.json b/tests/integration/snapshots/return_values/async-metrics_python37_sqs.json index 9af9d67b..970f7dff 100644 --- a/tests/integration/snapshots/return_values/async-metrics_python37_sqs.json +++ b/tests/integration/snapshots/return_values/async-metrics_python37_sqs.json @@ -1,4 +1,11 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": null, + "event_record_ids": [ + "059f36b4-87a3-44ab-83d2-661975830a7d", + "2e1424d4-f796-459a-8184-9c92662be6da" + ] + } } diff --git a/tests/integration/snapshots/return_values/async-metrics_python38_api-gateway-get.json b/tests/integration/snapshots/return_values/async-metrics_python38_api-gateway-get.json index 9af9d67b..22038093 100644 --- a/tests/integration/snapshots/return_values/async-metrics_python38_api-gateway-get.json +++ b/tests/integration/snapshots/return_values/async-metrics_python38_api-gateway-get.json @@ -1,4 +1,8 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": "41b45ea3-70b5-11e6-b7bd-69b5aaebc7d9", + "event_record_ids": [] + } } diff --git a/tests/integration/snapshots/return_values/async-metrics_python38_sns.json b/tests/integration/snapshots/return_values/async-metrics_python38_sns.json index 9af9d67b..e1f007e6 100644 --- a/tests/integration/snapshots/return_values/async-metrics_python38_sns.json +++ b/tests/integration/snapshots/return_values/async-metrics_python38_sns.json @@ -1,4 +1,10 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": null, + "event_record_ids": [ + "95df01b4-ee98-5cb9-9903-4c221d41eb5e" + ] + } } diff --git a/tests/integration/snapshots/return_values/async-metrics_python38_sqs.json b/tests/integration/snapshots/return_values/async-metrics_python38_sqs.json index 9af9d67b..970f7dff 100644 --- a/tests/integration/snapshots/return_values/async-metrics_python38_sqs.json +++ b/tests/integration/snapshots/return_values/async-metrics_python38_sqs.json @@ -1,4 +1,11 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": null, + "event_record_ids": [ + "059f36b4-87a3-44ab-83d2-661975830a7d", + "2e1424d4-f796-459a-8184-9c92662be6da" + ] + } } diff --git a/tests/integration/snapshots/return_values/http-requests_python27_api-gateway-get.json b/tests/integration/snapshots/return_values/http-requests_python27_api-gateway-get.json index 403ec11f..2b4bed60 100644 --- a/tests/integration/snapshots/return_values/http-requests_python27_api-gateway-get.json +++ b/tests/integration/snapshots/return_values/http-requests_python27_api-gateway-get.json @@ -1,4 +1,6 @@ { - "body": "hello, dog!", + "body": { + "message": "hello, dog!" + }, "statusCode": 200 } diff --git a/tests/integration/snapshots/return_values/http-requests_python27_sns.json b/tests/integration/snapshots/return_values/http-requests_python27_sns.json index 403ec11f..2b4bed60 100644 --- a/tests/integration/snapshots/return_values/http-requests_python27_sns.json +++ b/tests/integration/snapshots/return_values/http-requests_python27_sns.json @@ -1,4 +1,6 @@ { - "body": "hello, dog!", + "body": { + "message": "hello, dog!" + }, "statusCode": 200 } diff --git a/tests/integration/snapshots/return_values/http-requests_python27_sqs.json b/tests/integration/snapshots/return_values/http-requests_python27_sqs.json index 403ec11f..2b4bed60 100644 --- a/tests/integration/snapshots/return_values/http-requests_python27_sqs.json +++ b/tests/integration/snapshots/return_values/http-requests_python27_sqs.json @@ -1,4 +1,6 @@ { - "body": "hello, dog!", + "body": { + "message": "hello, dog!" + }, "statusCode": 200 } diff --git a/tests/integration/snapshots/return_values/http-requests_python36_api-gateway-get.json b/tests/integration/snapshots/return_values/http-requests_python36_api-gateway-get.json index 9af9d67b..2f8a4b8d 100644 --- a/tests/integration/snapshots/return_values/http-requests_python36_api-gateway-get.json +++ b/tests/integration/snapshots/return_values/http-requests_python36_api-gateway-get.json @@ -1,4 +1,6 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!" + } } diff --git a/tests/integration/snapshots/return_values/http-requests_python36_sns.json b/tests/integration/snapshots/return_values/http-requests_python36_sns.json index 9af9d67b..2f8a4b8d 100644 --- a/tests/integration/snapshots/return_values/http-requests_python36_sns.json +++ b/tests/integration/snapshots/return_values/http-requests_python36_sns.json @@ -1,4 +1,6 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!" + } } diff --git a/tests/integration/snapshots/return_values/http-requests_python36_sqs.json b/tests/integration/snapshots/return_values/http-requests_python36_sqs.json index 9af9d67b..2f8a4b8d 100644 --- a/tests/integration/snapshots/return_values/http-requests_python36_sqs.json +++ b/tests/integration/snapshots/return_values/http-requests_python36_sqs.json @@ -1,4 +1,6 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!" + } } diff --git a/tests/integration/snapshots/return_values/http-requests_python37_api-gateway-get.json b/tests/integration/snapshots/return_values/http-requests_python37_api-gateway-get.json index 9af9d67b..2f8a4b8d 100644 --- a/tests/integration/snapshots/return_values/http-requests_python37_api-gateway-get.json +++ b/tests/integration/snapshots/return_values/http-requests_python37_api-gateway-get.json @@ -1,4 +1,6 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!" + } } diff --git a/tests/integration/snapshots/return_values/http-requests_python37_sns.json b/tests/integration/snapshots/return_values/http-requests_python37_sns.json index 9af9d67b..2f8a4b8d 100644 --- a/tests/integration/snapshots/return_values/http-requests_python37_sns.json +++ b/tests/integration/snapshots/return_values/http-requests_python37_sns.json @@ -1,4 +1,6 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!" + } } diff --git a/tests/integration/snapshots/return_values/http-requests_python37_sqs.json b/tests/integration/snapshots/return_values/http-requests_python37_sqs.json index 9af9d67b..2f8a4b8d 100644 --- a/tests/integration/snapshots/return_values/http-requests_python37_sqs.json +++ b/tests/integration/snapshots/return_values/http-requests_python37_sqs.json @@ -1,4 +1,6 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!" + } } diff --git a/tests/integration/snapshots/return_values/http-requests_python38_api-gateway-get.json b/tests/integration/snapshots/return_values/http-requests_python38_api-gateway-get.json index 9af9d67b..2f8a4b8d 100644 --- a/tests/integration/snapshots/return_values/http-requests_python38_api-gateway-get.json +++ b/tests/integration/snapshots/return_values/http-requests_python38_api-gateway-get.json @@ -1,4 +1,6 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!" + } } diff --git a/tests/integration/snapshots/return_values/http-requests_python38_sns.json b/tests/integration/snapshots/return_values/http-requests_python38_sns.json index 9af9d67b..2f8a4b8d 100644 --- a/tests/integration/snapshots/return_values/http-requests_python38_sns.json +++ b/tests/integration/snapshots/return_values/http-requests_python38_sns.json @@ -1,4 +1,6 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!" + } } diff --git a/tests/integration/snapshots/return_values/http-requests_python38_sqs.json b/tests/integration/snapshots/return_values/http-requests_python38_sqs.json index 9af9d67b..2f8a4b8d 100644 --- a/tests/integration/snapshots/return_values/http-requests_python38_sqs.json +++ b/tests/integration/snapshots/return_values/http-requests_python38_sqs.json @@ -1,4 +1,6 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!" + } } diff --git a/tests/integration/snapshots/return_values/sync-metrics_python27_api-gateway-get.json b/tests/integration/snapshots/return_values/sync-metrics_python27_api-gateway-get.json index 403ec11f..d8e93bb0 100644 --- a/tests/integration/snapshots/return_values/sync-metrics_python27_api-gateway-get.json +++ b/tests/integration/snapshots/return_values/sync-metrics_python27_api-gateway-get.json @@ -1,4 +1,8 @@ { - "body": "hello, dog!", + "body": { + "message": "hello, dog!", + "event_record_ids": [], + "request_id": "41b45ea3-70b5-11e6-b7bd-69b5aaebc7d9" + }, "statusCode": 200 } diff --git a/tests/integration/snapshots/return_values/sync-metrics_python27_sns.json b/tests/integration/snapshots/return_values/sync-metrics_python27_sns.json index 403ec11f..08cbae60 100644 --- a/tests/integration/snapshots/return_values/sync-metrics_python27_sns.json +++ b/tests/integration/snapshots/return_values/sync-metrics_python27_sns.json @@ -1,4 +1,10 @@ { - "body": "hello, dog!", + "body": { + "message": "hello, dog!", + "event_record_ids": [ + "95df01b4-ee98-5cb9-9903-4c221d41eb5e" + ], + "request_id": null + }, "statusCode": 200 } diff --git a/tests/integration/snapshots/return_values/sync-metrics_python27_sqs.json b/tests/integration/snapshots/return_values/sync-metrics_python27_sqs.json index 403ec11f..03f2a6cd 100644 --- a/tests/integration/snapshots/return_values/sync-metrics_python27_sqs.json +++ b/tests/integration/snapshots/return_values/sync-metrics_python27_sqs.json @@ -1,4 +1,11 @@ { - "body": "hello, dog!", + "body": { + "message": "hello, dog!", + "event_record_ids": [ + "059f36b4-87a3-44ab-83d2-661975830a7d", + "2e1424d4-f796-459a-8184-9c92662be6da" + ], + "request_id": null + }, "statusCode": 200 } diff --git a/tests/integration/snapshots/return_values/sync-metrics_python36_api-gateway-get.json b/tests/integration/snapshots/return_values/sync-metrics_python36_api-gateway-get.json index 9af9d67b..22038093 100644 --- a/tests/integration/snapshots/return_values/sync-metrics_python36_api-gateway-get.json +++ b/tests/integration/snapshots/return_values/sync-metrics_python36_api-gateway-get.json @@ -1,4 +1,8 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": "41b45ea3-70b5-11e6-b7bd-69b5aaebc7d9", + "event_record_ids": [] + } } diff --git a/tests/integration/snapshots/return_values/sync-metrics_python36_sns.json b/tests/integration/snapshots/return_values/sync-metrics_python36_sns.json index 9af9d67b..e1f007e6 100644 --- a/tests/integration/snapshots/return_values/sync-metrics_python36_sns.json +++ b/tests/integration/snapshots/return_values/sync-metrics_python36_sns.json @@ -1,4 +1,10 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": null, + "event_record_ids": [ + "95df01b4-ee98-5cb9-9903-4c221d41eb5e" + ] + } } diff --git a/tests/integration/snapshots/return_values/sync-metrics_python36_sqs.json b/tests/integration/snapshots/return_values/sync-metrics_python36_sqs.json index 9af9d67b..970f7dff 100644 --- a/tests/integration/snapshots/return_values/sync-metrics_python36_sqs.json +++ b/tests/integration/snapshots/return_values/sync-metrics_python36_sqs.json @@ -1,4 +1,11 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": null, + "event_record_ids": [ + "059f36b4-87a3-44ab-83d2-661975830a7d", + "2e1424d4-f796-459a-8184-9c92662be6da" + ] + } } diff --git a/tests/integration/snapshots/return_values/sync-metrics_python37_api-gateway-get.json b/tests/integration/snapshots/return_values/sync-metrics_python37_api-gateway-get.json index 9af9d67b..22038093 100644 --- a/tests/integration/snapshots/return_values/sync-metrics_python37_api-gateway-get.json +++ b/tests/integration/snapshots/return_values/sync-metrics_python37_api-gateway-get.json @@ -1,4 +1,8 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": "41b45ea3-70b5-11e6-b7bd-69b5aaebc7d9", + "event_record_ids": [] + } } diff --git a/tests/integration/snapshots/return_values/sync-metrics_python37_sns.json b/tests/integration/snapshots/return_values/sync-metrics_python37_sns.json index 9af9d67b..e1f007e6 100644 --- a/tests/integration/snapshots/return_values/sync-metrics_python37_sns.json +++ b/tests/integration/snapshots/return_values/sync-metrics_python37_sns.json @@ -1,4 +1,10 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": null, + "event_record_ids": [ + "95df01b4-ee98-5cb9-9903-4c221d41eb5e" + ] + } } diff --git a/tests/integration/snapshots/return_values/sync-metrics_python37_sqs.json b/tests/integration/snapshots/return_values/sync-metrics_python37_sqs.json index 9af9d67b..970f7dff 100644 --- a/tests/integration/snapshots/return_values/sync-metrics_python37_sqs.json +++ b/tests/integration/snapshots/return_values/sync-metrics_python37_sqs.json @@ -1,4 +1,11 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": null, + "event_record_ids": [ + "059f36b4-87a3-44ab-83d2-661975830a7d", + "2e1424d4-f796-459a-8184-9c92662be6da" + ] + } } diff --git a/tests/integration/snapshots/return_values/sync-metrics_python38_api-gateway-get.json b/tests/integration/snapshots/return_values/sync-metrics_python38_api-gateway-get.json index 9af9d67b..22038093 100644 --- a/tests/integration/snapshots/return_values/sync-metrics_python38_api-gateway-get.json +++ b/tests/integration/snapshots/return_values/sync-metrics_python38_api-gateway-get.json @@ -1,4 +1,8 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": "41b45ea3-70b5-11e6-b7bd-69b5aaebc7d9", + "event_record_ids": [] + } } diff --git a/tests/integration/snapshots/return_values/sync-metrics_python38_sns.json b/tests/integration/snapshots/return_values/sync-metrics_python38_sns.json index 9af9d67b..e1f007e6 100644 --- a/tests/integration/snapshots/return_values/sync-metrics_python38_sns.json +++ b/tests/integration/snapshots/return_values/sync-metrics_python38_sns.json @@ -1,4 +1,10 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": null, + "event_record_ids": [ + "95df01b4-ee98-5cb9-9903-4c221d41eb5e" + ] + } } diff --git a/tests/integration/snapshots/return_values/sync-metrics_python38_sqs.json b/tests/integration/snapshots/return_values/sync-metrics_python38_sqs.json index 9af9d67b..970f7dff 100644 --- a/tests/integration/snapshots/return_values/sync-metrics_python38_sqs.json +++ b/tests/integration/snapshots/return_values/sync-metrics_python38_sqs.json @@ -1,4 +1,11 @@ { "statusCode": 200, - "body": "hello, dog!" + "body": { + "message": "hello, dog!", + "request_id": null, + "event_record_ids": [ + "059f36b4-87a3-44ab-83d2-661975830a7d", + "2e1424d4-f796-459a-8184-9c92662be6da" + ] + } } From 1ced36e4076d9aaf4bb0b4dfdf24cd3e4444fa9d Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Tue, 10 Mar 2020 15:43:51 -0400 Subject: [PATCH 16/19] Replace account IDs with XXXX --- scripts/run_integration_tests.sh | 4 ++-- tests/integration/snapshots/logs/async-metrics_python27.log | 6 +++--- tests/integration/snapshots/logs/async-metrics_python36.log | 6 +++--- tests/integration/snapshots/logs/async-metrics_python37.log | 6 +++--- tests/integration/snapshots/logs/async-metrics_python38.log | 6 +++--- tests/integration/snapshots/logs/http-requests_python27.log | 6 +++--- tests/integration/snapshots/logs/http-requests_python36.log | 6 +++--- tests/integration/snapshots/logs/http-requests_python37.log | 6 +++--- tests/integration/snapshots/logs/http-requests_python38.log | 6 +++--- tests/integration/snapshots/logs/sync-metrics_python27.log | 6 +++--- tests/integration/snapshots/logs/sync-metrics_python36.log | 6 +++--- tests/integration/snapshots/logs/sync-metrics_python37.log | 6 +++--- tests/integration/snapshots/logs/sync-metrics_python38.log | 6 +++--- 13 files changed, 38 insertions(+), 38 deletions(-) diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index e1dd400c..2efa0b4b 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -109,8 +109,8 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do sed '/^$/d' | # Normalize Lambda runtime report logs sed -E 's/(RequestId|TraceId|SegmentId|Duration|Memory Used|"e"): [a-z0-9\.\-]+/\1: XXXX/g' | - # Normalize DD APM headers - sed -E "s/(x-datadog-parent-id:|x-datadog-trace-id:)[0-9]+/\1XXXX/g" | + # Normalize DD APM headers and AWS account ID + sed -E "s/(x-datadog-parent-id:|x-datadog-trace-id:|account_id:)[0-9]+/\1XXXX/g" | # Normalize timestamps in datapoints POSTed to DD sed -E 's/"points": \[\[[0-9\.]+,/"points": \[\[XXXX,/g' | # Strip API key from logged requests diff --git a/tests/integration/snapshots/logs/async-metrics_python27.log b/tests/integration/snapshots/logs/async-metrics_python27.log index faa6f6c1..7ff042d8 100644 --- a/tests/integration/snapshots/logs/async-metrics_python27.log +++ b/tests/integration/snapshots/logs/async-metrics_python27.log @@ -1,19 +1,19 @@ START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} {"e": XXXX, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} {"e": XXXX, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 21} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} {"e": XXXX, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} {"e": XXXX, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 21} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} {"e": XXXX, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} {"e": XXXX, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 21} END RequestId: XXXX diff --git a/tests/integration/snapshots/logs/async-metrics_python36.log b/tests/integration/snapshots/logs/async-metrics_python36.log index 825f4ae2..5ec2bb9c 100644 --- a/tests/integration/snapshots/logs/async-metrics_python36.log +++ b/tests/integration/snapshots/logs/async-metrics_python36.log @@ -1,19 +1,19 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} {"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} {"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} {"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} {"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} {"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} {"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} END RequestId: XXXX diff --git a/tests/integration/snapshots/logs/async-metrics_python37.log b/tests/integration/snapshots/logs/async-metrics_python37.log index 2b5398c1..79da381f 100644 --- a/tests/integration/snapshots/logs/async-metrics_python37.log +++ b/tests/integration/snapshots/logs/async-metrics_python37.log @@ -1,19 +1,19 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} {"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} {"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} {"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} {"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} {"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} {"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} END RequestId: XXXX diff --git a/tests/integration/snapshots/logs/async-metrics_python38.log b/tests/integration/snapshots/logs/async-metrics_python38.log index e31623c1..53d75e5b 100644 --- a/tests/integration/snapshots/logs/async-metrics_python38.log +++ b/tests/integration/snapshots/logs/async-metrics_python38.log @@ -1,19 +1,19 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} {"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} {"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} {"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} {"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} {"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} {"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} END RequestId: XXXX diff --git a/tests/integration/snapshots/logs/http-requests_python27.log b/tests/integration/snapshots/logs/http-requests_python27.log index 432e9d59..68855179 100644 --- a/tests/integration/snapshots/logs/http-requests_python27.log +++ b/tests/integration/snapshots/logs/http-requests_python27.log @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} @@ -7,7 +7,7 @@ END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} @@ -15,7 +15,7 @@ END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} diff --git a/tests/integration/snapshots/logs/http-requests_python36.log b/tests/integration/snapshots/logs/http-requests_python36.log index 3dc6f0de..747032e2 100644 --- a/tests/integration/snapshots/logs/http-requests_python36.log +++ b/tests/integration/snapshots/logs/http-requests_python36.log @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} @@ -7,7 +7,7 @@ END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} @@ -15,7 +15,7 @@ END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} diff --git a/tests/integration/snapshots/logs/http-requests_python37.log b/tests/integration/snapshots/logs/http-requests_python37.log index 890fb8c5..bc9d654f 100644 --- a/tests/integration/snapshots/logs/http-requests_python37.log +++ b/tests/integration/snapshots/logs/http-requests_python37.log @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} @@ -7,7 +7,7 @@ END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} @@ -15,7 +15,7 @@ END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} diff --git a/tests/integration/snapshots/logs/http-requests_python38.log b/tests/integration/snapshots/logs/http-requests_python38.log index a1284d8d..662aef59 100644 --- a/tests/integration/snapshots/logs/http-requests_python38.log +++ b/tests/integration/snapshots/logs/http-requests_python38.log @@ -1,5 +1,5 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} @@ -7,7 +7,7 @@ END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} @@ -15,7 +15,7 @@ END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-http-requests_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} diff --git a/tests/integration/snapshots/logs/sync-metrics_python27.log b/tests/integration/snapshots/logs/sync-metrics_python27.log index 7b9dde14..f6d3acc5 100644 --- a/tests/integration/snapshots/logs/sync-metrics_python27.log +++ b/tests/integration/snapshots/logs/sync-metrics_python27.log @@ -1,17 +1,17 @@ START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB diff --git a/tests/integration/snapshots/logs/sync-metrics_python36.log b/tests/integration/snapshots/logs/sync-metrics_python36.log index b439b1d1..29720295 100644 --- a/tests/integration/snapshots/logs/sync-metrics_python36.log +++ b/tests/integration/snapshots/logs/sync-metrics_python36.log @@ -1,17 +1,17 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB diff --git a/tests/integration/snapshots/logs/sync-metrics_python37.log b/tests/integration/snapshots/logs/sync-metrics_python37.log index dd7679a3..ccedc032 100644 --- a/tests/integration/snapshots/logs/sync-metrics_python37.log +++ b/tests/integration/snapshots/logs/sync-metrics_python37.log @@ -1,17 +1,17 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB diff --git a/tests/integration/snapshots/logs/sync-metrics_python38.log b/tests/integration/snapshots/logs/sync-metrics_python38.log index 1cc472b5..015f99a4 100644 --- a/tests/integration/snapshots/logs/sync-metrics_python38.log +++ b/tests/integration/snapshots/logs/sync-metrics_python38.log @@ -1,17 +1,17 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:601427279990", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB From 8d7b0c656bbbcb67354961c8c7b45dae5b94f196 Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Tue, 10 Mar 2020 15:46:12 -0400 Subject: [PATCH 17/19] Clarify instructions for re-running --- scripts/run_integration_tests.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index 2efa0b4b..f49a4b53 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Usage: +# Usage - run commands from repo root: # To check if new changes to the layer cause changes to any snapshots: # BUILD_LAYERS=true DD_API_KEY=XXXX aws-vault exec sandbox-account-admin -- ./scripts/run_integration_tests # To regenerate snapshots: @@ -37,7 +37,7 @@ if [ -n "$BUILD_LAYERS" ]; then echo "Building layers that will be deployed with our test functions" source $scripts_dir/build_layers.sh else - echo "Not building layers, ensure they've already been built or re-run with 'REBUILD_LAYERS=true ./scripts/run_integration_tests.sh'" + echo "Not building layers, ensure they've already been built or re-run with 'REBUILD_LAYERS=true DD_API_KEY=XXXX ./scripts/run_integration_tests.sh'" fi cd $integration_tests_dir @@ -143,7 +143,7 @@ done if [ "$mismatch_found" = true ]; then echo "FAILURE: A mismatch between new data and a snapshot was found and printed above." - echo "If the change is expected, generate new snapshots by running 'UPDATE_SNAPSHOTS=true ./scripts/run_integration_tests.sh'" + echo "If the change is expected, generate new snapshots by running 'UPDATE_SNAPSHOTS=true DD_API_KEY=XXXX ./scripts/run_integration_tests.sh'" exit 1 fi From ea661a66f6ab33cc5c1fd9c352e784ab3aee66ef Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Tue, 10 Mar 2020 16:16:28 -0400 Subject: [PATCH 18/19] Replace minor version in tag with XX to make tests less brittle --- scripts/run_integration_tests.sh | 4 +++- .../snapshots/logs/async-metrics_python27.log | 18 +++++++++--------- .../snapshots/logs/async-metrics_python36.log | 18 +++++++++--------- .../snapshots/logs/async-metrics_python37.log | 18 +++++++++--------- .../snapshots/logs/async-metrics_python38.log | 18 +++++++++--------- .../snapshots/logs/http-requests_python27.log | 12 ++++++------ .../snapshots/logs/http-requests_python36.log | 12 ++++++------ .../snapshots/logs/http-requests_python37.log | 12 ++++++------ .../snapshots/logs/http-requests_python38.log | 12 ++++++------ .../snapshots/logs/sync-metrics_python27.log | 12 ++++++------ .../snapshots/logs/sync-metrics_python36.log | 12 ++++++------ .../snapshots/logs/sync-metrics_python37.log | 12 ++++++------ .../snapshots/logs/sync-metrics_python38.log | 12 ++++++------ 13 files changed, 87 insertions(+), 85 deletions(-) diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index f49a4b53..10ab7099 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -114,7 +114,9 @@ for handler_name in "${LAMBDA_HANDLERS[@]}"; do # Normalize timestamps in datapoints POSTed to DD sed -E 's/"points": \[\[[0-9\.]+,/"points": \[\[XXXX,/g' | # Strip API key from logged requests - sed -E "s/(api_key=|'api_key': ')[a-z0-9\.\-]+/\1XXXX/g" + sed -E "s/(api_key=|'api_key': ')[a-z0-9\.\-]+/\1XXXX/g" | + # Normalize minor package version so that these snapshots aren't broken on version bumps + sed -E "s/(dd_lambda_layer:datadog-python[0-9]+_2\.)[0-9]+\.0/\1XX\.0/g" ) if [ ! -f $function_snapshot_path ]; then diff --git a/tests/integration/snapshots/logs/async-metrics_python27.log b/tests/integration/snapshots/logs/async-metrics_python27.log index 7ff042d8..b5160960 100644 --- a/tests/integration/snapshots/logs/async-metrics_python27.log +++ b/tests/integration/snapshots/logs/async-metrics_python27.log @@ -1,21 +1,21 @@ START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -{"e": XXXX, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -{"e": XXXX, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 21} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.XX.0"], "v": 1} +{"e": XXXX, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "v": 1} +{"e": XXXX, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "v": 21} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -{"e": XXXX, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -{"e": XXXX, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 21} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.XX.0"], "v": 1} +{"e": XXXX, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "v": 1} +{"e": XXXX, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "v": 21} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -{"e": XXXX, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -{"e": XXXX, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 21} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.XX.0"], "v": 1} +{"e": XXXX, "m": "hello.dog", "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "v": 1} +{"e": XXXX, "m": "tests.integration.count", "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "v": 21} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/async-metrics_python36.log b/tests/integration/snapshots/logs/async-metrics_python36.log index 5ec2bb9c..1f967c38 100644 --- a/tests/integration/snapshots/logs/async-metrics_python36.log +++ b/tests/integration/snapshots/logs/async-metrics_python36.log @@ -1,21 +1,21 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} -{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} -{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.XX.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} -{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} -{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.XX.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} -{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} -{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.XX.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/async-metrics_python37.log b/tests/integration/snapshots/logs/async-metrics_python37.log index 79da381f..8aa9d0ca 100644 --- a/tests/integration/snapshots/logs/async-metrics_python37.log +++ b/tests/integration/snapshots/logs/async-metrics_python37.log @@ -1,21 +1,21 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} -{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} -{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.XX.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} -{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} -{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.XX.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} -{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} -{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.XX.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/async-metrics_python38.log b/tests/integration/snapshots/logs/async-metrics_python38.log index 53d75e5b..dba8434b 100644 --- a/tests/integration/snapshots/logs/async-metrics_python38.log +++ b/tests/integration/snapshots/logs/async-metrics_python38.log @@ -1,21 +1,21 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} -{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} -{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.XX.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} -{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} -{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.XX.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} -{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} -{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-async-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.XX.0"]} +{"m": "hello.dog", "v": 1, "e": XXXX, "t": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"]} +{"m": "tests.integration.count", "v": 21, "e": XXXX, "t": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/http-requests_python27.log b/tests/integration/snapshots/logs/http-requests_python27.log index 68855179..26003f91 100644 --- a/tests/integration/snapshots/logs/http-requests_python27.log +++ b/tests/integration/snapshots/logs/http-requests_python27.log @@ -1,24 +1,24 @@ START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.XX.0"], "v": 1} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.XX.0"], "v": 1} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.XX.0"], "v": 1} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/http-requests_python36.log b/tests/integration/snapshots/logs/http-requests_python36.log index 747032e2..c1c839d8 100644 --- a/tests/integration/snapshots/logs/http-requests_python36.log +++ b/tests/integration/snapshots/logs/http-requests_python36.log @@ -1,24 +1,24 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.XX.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.XX.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.XX.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/http-requests_python37.log b/tests/integration/snapshots/logs/http-requests_python37.log index bc9d654f..2c037c43 100644 --- a/tests/integration/snapshots/logs/http-requests_python37.log +++ b/tests/integration/snapshots/logs/http-requests_python37.log @@ -1,24 +1,24 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.XX.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.XX.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.XX.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/http-requests_python38.log b/tests/integration/snapshots/logs/http-requests_python38.log index 662aef59..a67728d3 100644 --- a/tests/integration/snapshots/logs/http-requests_python38.log +++ b/tests/integration/snapshots/logs/http-requests_python38.log @@ -1,24 +1,24 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.XX.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.XX.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-http-requests_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.XX.0"]} HTTP GET https://ip-ranges.datadoghq.com/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} HTTP GET https://ip-ranges.datadoghq.eu/ Headers: ["x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/sync-metrics_python27.log b/tests/integration/snapshots/logs/sync-metrics_python27.log index f6d3acc5..17385b8e 100644 --- a/tests/integration/snapshots/logs/sync-metrics_python27.log +++ b/tests/integration/snapshots/logs/sync-metrics_python27.log @@ -1,18 +1,18 @@ START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:true", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.XX.0"], "v": 1} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.XX.0"], "v": 1} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.13.0"], "v": 1} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.13.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} +{"e": XXXX, "m": "aws.lambda.enhanced.invocations", "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python27", "cold_start:false", "memorysize:1024", "runtime:python2.7", "dd_lambda_layer:datadog-python27_2.XX.0"], "v": 1} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "metric": "hello.dog", "interval": 10, "host": null, "points": [[XXXX, [1.0]]], "device": null, "type": "distribution"}, {"tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python27_2.XX.0"], "metric": "tests.integration.count", "interval": 10, "host": null, "points": [[XXXX, [21.0]]], "device": null, "type": "distribution"}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/sync-metrics_python36.log b/tests/integration/snapshots/logs/sync-metrics_python36.log index 29720295..32319380 100644 --- a/tests/integration/snapshots/logs/sync-metrics_python36.log +++ b/tests/integration/snapshots/logs/sync-metrics_python36.log @@ -1,18 +1,18 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:true", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.XX.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.XX.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.13.0"]} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.13.0"], "interval": 10}]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python36", "cold_start:false", "memorysize:1024", "runtime:python3.6", "dd_lambda_layer:datadog-python36_2.XX.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python36_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/sync-metrics_python37.log b/tests/integration/snapshots/logs/sync-metrics_python37.log index ccedc032..85cb79bd 100644 --- a/tests/integration/snapshots/logs/sync-metrics_python37.log +++ b/tests/integration/snapshots/logs/sync-metrics_python37.log @@ -1,18 +1,18 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:true", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.XX.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.XX.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.13.0"]} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.13.0"], "interval": 10}]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python37", "cold_start:false", "memorysize:1024", "runtime:python3.7", "dd_lambda_layer:datadog-python37_2.XX.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python37_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true diff --git a/tests/integration/snapshots/logs/sync-metrics_python38.log b/tests/integration/snapshots/logs/sync-metrics_python38.log index 015f99a4..baf56809 100644 --- a/tests/integration/snapshots/logs/sync-metrics_python38.log +++ b/tests/integration/snapshots/logs/sync-metrics_python38.log @@ -1,18 +1,18 @@ START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:true", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.XX.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB Init Duration: XXXX ms XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.XX.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true START RequestId: XXXX Version: $LATEST -{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.13.0"]} -HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.13.0"], "interval": 10}]} +{"m": "aws.lambda.enhanced.invocations", "v": 1, "e": XXXX, "t": ["region:us-east-1", "account_id:XXXX", "functionname:integration-tester-dev-sync-metrics_python38", "cold_start:false", "memorysize:1024", "runtime:python3.8", "dd_lambda_layer:datadog-python38_2.XX.0"]} +HTTP POST https://api.datadoghq.com/api/v1/distribution_points Headers: ["Content-Type:application/json", "x-datadog-parent-id:XXXX", "x-datadog-sampling-priority:2", "x-datadog-trace-id:XXXX"] Data: {"series": [{"metric": "hello.dog", "points": [[XXXX, [1.0]]], "type": "distribution", "host": null, "device": null, "tags": ["team:serverless", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"], "interval": 10}, {"metric": "tests.integration.count", "points": [[XXXX, [21.0]]], "type": "distribution", "host": null, "device": null, "tags": ["test:integration", "role:hello", "dd_lambda_layer:datadog-python38_2.XX.0"], "interval": 10}]} END RequestId: XXXX REPORT RequestId: XXXX Duration: XXXX ms Billed Duration: XXXX ms Memory Size: 1024 MB Max Memory Used: XXXX MB XRAY TraceId: XXXX SegmentId: XXXX Sampled: true From f47d412bc96352156795bdaf47815a64a9076baa Mon Sep 17 00:00:00 2001 From: Stephen Firrincieli Date: Tue, 10 Mar 2020 16:48:06 -0400 Subject: [PATCH 19/19] Clarify echo messages --- scripts/run_integration_tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/run_integration_tests.sh b/scripts/run_integration_tests.sh index 10ab7099..c9f7df55 100755 --- a/scripts/run_integration_tests.sh +++ b/scripts/run_integration_tests.sh @@ -37,7 +37,7 @@ if [ -n "$BUILD_LAYERS" ]; then echo "Building layers that will be deployed with our test functions" source $scripts_dir/build_layers.sh else - echo "Not building layers, ensure they've already been built or re-run with 'REBUILD_LAYERS=true DD_API_KEY=XXXX ./scripts/run_integration_tests.sh'" + echo "Not building layers, ensure they've already been built or re-run with 'BUILD_LAYERS=true DD_API_KEY=XXXX ./scripts/run_integration_tests.sh'" fi cd $integration_tests_dir @@ -154,4 +154,4 @@ if [ -n "$UPDATE_SNAPSHOTS" ]; then exit 0 fi -echo "SUCCESS: No difference found between new logs and snapshots" +echo "SUCCESS: No difference found between snapshots and new return values or logs"