Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lambda): add instrument handler option to adotInstrumentation to support python lambda functions #26040

Merged
merged 28 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7ce7dfc
feat(instrument handler for adot implementation of python for lambda …
randyridgley Jun 19, 2023
b235040
Merge branch 'main' of https://github.com/randyridgley/aws-cdk into main
randyridgley Jun 19, 2023
402fa5e
Merge branch 'aws:main' into main
randyridgley Jun 19, 2023
68d2cf8
Merge branch 'main' into main
randyridgley Jun 21, 2023
a67257b
fix(lambda) add integration test and update README
randyridgley Jun 26, 2023
e047016
Merge branch 'aws:main' into main
randyridgley Jun 26, 2023
c915cf5
fix(lambda) reverting the framework-integ test and creating a new one…
randyridgley Jun 26, 2023
4c75478
Merge branch 'main' of https://github.com/randyridgley/aws-cdk into main
randyridgley Jun 26, 2023
634fd2c
Merge branch 'main' into main
randyridgley Jun 28, 2023
c00f9cc
fix(lambda) add snapshot update for integration test for adding INSTR…
randyridgley Jun 28, 2023
f7c4ecd
Merge branch 'main' into main
randyridgley Jun 28, 2023
c5a8a6c
Merge branch 'aws:main' into main
randyridgley Jun 29, 2023
0ea231f
fix(lambda) remove duplicated integ test from the aws-lambda test dir…
randyridgley Jun 30, 2023
cb29d71
Merge branch 'main' of https://github.com/randyridgley/aws-cdk into main
randyridgley Jun 30, 2023
cd6704e
fix(lambda) add validation for Adot Instrumentation when using Python…
randyridgley Jul 3, 2023
a619802
Merge branch 'main' into main
randyridgley Jul 3, 2023
69e5052
fix(lambda) add validation for Adot Instrumentation when using Python…
randyridgley Jul 3, 2023
af728fa
Merge branch 'main' of https://github.com/randyridgley/aws-cdk into main
randyridgley Jul 3, 2023
02d74fe
Merge branch 'main' into main
randyridgley Jul 3, 2023
5384f7b
Merge branch 'main' into main
randyridgley Jul 3, 2023
ee11cec
fix(lambda) needed to find the right comparison for PYTHON runtime of…
randyridgley Jul 3, 2023
4fac05a
Merge branch 'main' of https://github.com/randyridgley/aws-cdk into main
randyridgley Jul 3, 2023
1e92012
fix(lambda) left a linter issue removed reference of unused dep
randyridgley Jul 3, 2023
60825a8
Merge branch 'main' into main
randyridgley Jul 3, 2023
30575ba
fix(lambda) changes to integration tests to match error thrown when u…
randyridgley Jul 3, 2023
8e74a4c
Merge branch 'main' into main
randyridgley Jul 6, 2023
c5ea3a2
Merge branch 'main' into main
randyridgley Jul 7, 2023
3924e46
Merge branch 'main' into main
mergify[bot] Jul 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "22.0.0",
"version": "32.0.0",
"files": {
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
"source": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "22.0.0",
"version": "32.0.0",
"files": {
"47696196003068eea2528656bebb8f11e163f75e8635d774b801bbc06a0e57e2": {
"d6ee7e4c51eb94469044985064f496eb40f95c0a00a878bd6d34cc51523a0604": {
"source": {
"path": "Stack1.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "47696196003068eea2528656bebb8f11e163f75e8635d774b801bbc06a0e57e2.json",
"objectKey": "d6ee7e4c51eb94469044985064f496eb40f95c0a00a878bd6d34cc51523a0604.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,103 @@
"MyFunc5ServiceRoleDefaultPolicy96ABEA66",
"MyFunc5ServiceRoleFE4CE92B"
]
},
"MyFunc6ServiceRoleCDDBC2C6": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]
]
}
]
}
},
"MyFunc6ServiceRoleDefaultPolicyC4D4BF55": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": [
"xray:PutTelemetryRecords",
"xray:PutTraceSegments"
],
"Effect": "Allow",
"Resource": "*"
}
],
"Version": "2012-10-17"
},
"PolicyName": "MyFunc6ServiceRoleDefaultPolicyC4D4BF55",
"Roles": [
{
"Ref": "MyFunc6ServiceRoleCDDBC2C6"
}
]
}
},
"MyFunc60D944984": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"ZipFile": "def handler(event, context): pass"
},
"Role": {
"Fn::GetAtt": [
"MyFunc6ServiceRoleCDDBC2C6",
"Arn"
]
},
"Environment": {
"Variables": {
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/otel-instrument"
}
},
"Handler": "index.handler",
"Layers": [
{
"Fn::Join": [
"",
[
"arn:aws:lambda:",
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1"
]
]
}
],
"Runtime": "python3.9",
"TracingConfig": {
"Mode": "Active"
}
},
"DependsOn": [
"MyFunc6ServiceRoleDefaultPolicyC4D4BF55",
"MyFunc6ServiceRoleCDDBC2C6"
]
}
},
"Mappings": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "22.0.0",
"version": "32.0.0",
"files": {
"a4926065bd63dad984b7b214cd689e14b56eeec5afba89f078cd5134f8304bd8": {
"f0b810723fa4d04ba470b2df1ac4b7c9343aebfbec64e0f6b032fea5f3a5bea7": {
"source": {
"path": "Stack2.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "a4926065bd63dad984b7b214cd689e14b56eeec5afba89f078cd5134f8304bd8.json",
"objectKey": "f0b810723fa4d04ba470b2df1ac4b7c9343aebfbec64e0f6b032fea5f3a5bea7.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,103 @@
"MyFunc5ServiceRoleDefaultPolicy96ABEA66",
"MyFunc5ServiceRoleFE4CE92B"
]
},
"MyFunc6ServiceRoleCDDBC2C6": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]
]
}
]
}
},
"MyFunc6ServiceRoleDefaultPolicyC4D4BF55": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": [
"xray:PutTelemetryRecords",
"xray:PutTraceSegments"
],
"Effect": "Allow",
"Resource": "*"
}
],
"Version": "2012-10-17"
},
"PolicyName": "MyFunc6ServiceRoleDefaultPolicyC4D4BF55",
"Roles": [
{
"Ref": "MyFunc6ServiceRoleCDDBC2C6"
}
]
}
},
"MyFunc60D944984": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"ZipFile": "def handler(event, context): pass"
},
"Role": {
"Fn::GetAtt": [
"MyFunc6ServiceRoleCDDBC2C6",
"Arn"
]
},
"Environment": {
"Variables": {
"AWS_LAMBDA_EXEC_WRAPPER": "/opt/otel-instrument"
}
},
"Handler": "index.handler",
"Layers": [
{
"Fn::Join": [
"",
[
"arn:aws:lambda:",
{
"Ref": "AWS::Region"
},
":901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1"
]
]
}
],
"Runtime": "python3.9",
"TracingConfig": {
"Mode": "Active"
}
},
"DependsOn": [
"MyFunc6ServiceRoleDefaultPolicyC4D4BF55",
"MyFunc6ServiceRoleCDDBC2C6"
]
}
},
"Parameters": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"22.0.0"}
{"version":"32.0.0"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "22.0.0",
"version": "32.0.0",
"testCases": {
"IntegTest/DefaultTest": {
"stacks": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "22.0.0",
"version": "32.0.0",
"artifacts": {
"Stack1.assets": {
"type": "cdk:asset-manifest",
Expand All @@ -17,7 +17,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/47696196003068eea2528656bebb8f11e163f75e8635d774b801bbc06a0e57e2.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d6ee7e4c51eb94469044985064f496eb40f95c0a00a878bd6d34cc51523a0604.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down Expand Up @@ -129,6 +129,24 @@
"data": "MyFunc586573B53"
}
],
"/Stack1/MyFunc6/ServiceRole/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "MyFunc6ServiceRoleCDDBC2C6"
}
],
"/Stack1/MyFunc6/ServiceRole/DefaultPolicy/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "MyFunc6ServiceRoleDefaultPolicyC4D4BF55"
}
],
"/Stack1/MyFunc6/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "MyFunc60D944984"
}
],
"/Stack1/BootstrapVersion": [
{
"type": "aws:cdk:logicalId",
Expand Down Expand Up @@ -160,7 +178,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a4926065bd63dad984b7b214cd689e14b56eeec5afba89f078cd5134f8304bd8.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/f0b810723fa4d04ba470b2df1ac4b7c9343aebfbec64e0f6b032fea5f3a5bea7.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down Expand Up @@ -266,6 +284,24 @@
"data": "MyFunc586573B53"
}
],
"/Stack2/MyFunc6/ServiceRole/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "MyFunc6ServiceRoleCDDBC2C6"
}
],
"/Stack2/MyFunc6/ServiceRole/DefaultPolicy/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "MyFunc6ServiceRoleDefaultPolicyC4D4BF55"
}
],
"/Stack2/MyFunc6/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "MyFunc60D944984"
}
],
"/Stack2/BootstrapVersion": [
{
"type": "aws:cdk:logicalId",
Expand Down
Loading