Skip to content

Commit

Permalink
Support Python3.10 runtime for python Lambda Layer (#778)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasireddy99 authored Jul 6, 2023
1 parent c6a7138 commit 3252d0f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

strategy:
matrix:
python: ['3.8', '3.9']
python: ['3.8', '3.9', '3.10']

steps:
- name: Checkout this repo
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ terraform.*
.tox
__pycache__/*
.pyc
build.toml

*.zip
4 changes: 2 additions & 2 deletions collector/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ package: build

.PHONY: publish
publish:
aws lambda publish-layer-version --layer-name $(LAYER_NAME) --zip-file fileb://$(BUILD_SPACE)/opentelemetry-collector-layer-$(GOARCH).zip --compatible-runtimes nodejs14.x nodejs16.x nodejs18.x java11 python3.8 python3.9 --query 'LayerVersionArn' --output text
aws lambda publish-layer-version --layer-name $(LAYER_NAME) --zip-file fileb://$(BUILD_SPACE)/opentelemetry-collector-layer-$(GOARCH).zip --compatible-runtimes nodejs14.x nodejs16.x nodejs18.x java11 python3.8 python3.9 python3.10 --query 'LayerVersionArn' --output text

.PHONY: publish-layer
publish-layer: package
@echo Publishing collector extension layer...
aws lambda publish-layer-version --layer-name $(LAYER_NAME) --zip-file fileb://$(BUILD_SPACE)/opentelemetry-collector-layer-$(GOARCH).zip --compatible-runtimes nodejs14.x nodejs16.x nodejs18.x java11 python3.8 python3.9 --query 'LayerVersionArn' --output text
aws lambda publish-layer-version --layer-name $(LAYER_NAME) --zip-file fileb://$(BUILD_SPACE)/opentelemetry-collector-layer-$(GOARCH).zip --compatible-runtimes nodejs14.x nodejs16.x nodejs18.x java11 python3.8 python3.9 python3.10 --query 'LayerVersionArn' --output text
@echo OpenTelemetry Collector layer published.

.PHONY: gotidy
Expand Down
20 changes: 10 additions & 10 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Scripts and files used to build AWS Lambda Layers for running OpenTelemetry on A

### Sample App

1. Install
* [SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)
* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html)
* [Go](https://go.dev/doc/install)
* [Docker](https://docs.docker.com/get-docker)
3. Run aws configure to [set aws credential(with administrator permissions)](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-mac.html#serverless-sam-cli-install-mac-iam-permissions) and default region.
4. Download a local copy of this repository from Github.
5. `cd python/src`
6. If you just want to create a zip file with the OpenTelemetry Python AWS Lambda layer, then use the `-b true` option: `bash run.sh -n <LAYER_NAME_HERE> -b true`
7. If you want to create the layer and automatically publish it, use no options: `bash run.sh`
1. Install
* [SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)
* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html)
* [Go](https://go.dev/doc/install)
* [Docker](https://docs.docker.com/get-docker)
2. Run aws configure to [set aws credential(with administrator permissions)](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-mac.html#serverless-sam-cli-install-mac-iam-permissions) and default region.
3. Download a local copy of this repository from Github.
4. Navigate to the path `cd python/src`
5. If you just want to create a zip file with the OpenTelemetry Python AWS Lambda layer, then use the `-b true` option: `bash run.sh -n <LAYER_NAME_HERE> -b true`
6. If you want to create the layer and automatically publish it, use no options: `bash run.sh`
1 change: 1 addition & 0 deletions python/sample-apps/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ Resources:
CompatibleRuntimes:
- python3.8
- python3.9
- python3.10
Metadata:
BuildMethod: makefile
2 changes: 1 addition & 1 deletion python/src/otel/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG runtime=python3.9
ARG runtime=python3.10

FROM public.ecr.aws/sam/build-${runtime}

Expand Down
1 change: 1 addition & 0 deletions python/src/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Resources:
CompatibleRuntimes:
- python3.8
- python3.9
- python3.10
Metadata:
BuildMethod: makefile
api:
Expand Down
2 changes: 1 addition & 1 deletion python/src/tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
envlist =
; opentelemetry-instrumentation-aws-lambda
py3{8,9}-test-instrumentation-aws-lambda
py3{8,9,10}-test-instrumentation-aws-lambda

minversion = 3.8

Expand Down

0 comments on commit 3252d0f

Please sign in to comment.