Skip to content

Commit

Permalink
Merge branch 'main' into gen-ai-support
Browse files Browse the repository at this point in the history
  • Loading branch information
mxiamxia authored Nov 21, 2024
2 parents 01e490a + 3b378a6 commit e628ecd
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 53 deletions.
53 changes: 12 additions & 41 deletions .github/workflows/release_lambda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Release Lambda layer
on:
workflow_dispatch:
inputs:
version:
description: The version to tag the lambda release with, e.g., 1.2.0
required: true
aws_region:
description: 'Deploy to aws regions'
required: true
Expand Down Expand Up @@ -98,7 +101,7 @@ jobs:
aws lambda publish-layer-version \
--layer-name ${{ env.LAYER_NAME }} \
--content S3Bucket=${{ env.BUCKET_NAME }},S3Key=aws-opentelemetry-python-layer.zip \
--compatible-runtimes python3.10 python3.11 python3.12 \
--compatible-runtimes python3.10 python3.11 python3.12 python3.13 \
--compatible-architectures "arm64" "x86_64" \
--license-info "Apache-2.0" \
--description "AWS Distro of OpenTelemetry Lambda Layer for Python Runtime" \
Expand Down Expand Up @@ -184,45 +187,13 @@ jobs:
with:
name: layer.tf
path: layer.tf
- name: Commit changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
mv layer.tf lambda-layer/terraform/lambda/
git add lambda-layer/terraform/lambda/layer.tf
git commit -m "Update Lambda layer ARNs for releasing" || echo "No changes to commit"
git push
create-release:
runs-on: ubuntu-latest
needs: generate-release-note
steps:
- name: Checkout Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Get latest commit SHA
run: |
echo "COMMIT_SHA=${GITHUB_SHA}" >> $GITHUB_ENV
SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-7)
echo "SHORT_SHA=${SHORT_SHA}" >> $GITHUB_ENV
- name: Create Tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
TAG_NAME="lambda-${SHORT_SHA}"
git tag -a "$TAG_NAME" -m "Release Lambda layer based on commit $TAG_NAME"
git push origin "$TAG_NAME"
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
- name: Create GH release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
release_name: "Release AWSOpenTelemetryDistroPython Lambda Layer"
body_path: lambda-layer/terraform/lambda/layer.tf
draft: true
prerelease: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
run: |
gh release create --target "$GITHUB_REF_NAME" \
--title "Release lambda-v${{ github.event.inputs.version }}" \
--draft \
"lambda-v${{ github.event.inputs.version }}" \
layer.tf
4 changes: 2 additions & 2 deletions lambda-layer/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AWS Lambda Application Signals Support

This package provides support for **Application Signals** in AWS Lambda environment.
This folder provides support for **Application Signals** in AWS Lambda environments. You can explore this repository to learn how to build a Lambda layer for AWS Python Runtimes from scratch in your AWS account. Alternatively, you can directly visit the AWS documentation, [Enable Application Signals on Lambda functions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Signals-Enable-Lambda.html), and use the AWS-managed Lambda layers we provide.

## Features

Expand Down Expand Up @@ -53,4 +53,4 @@ Lambda function and view the traces and metrics through the AWS CloudWatch Conso
By default the layer enable botocore and aws-lambda instrumentation libraries only for better Lambda cold start performance. To
enable all opentelemetry python
supported libraries you can set environment variable `OTEL_PYTHON_DISABLED_INSTRUMENTATIONS=none`. Refer to details in
[OpenTelemetry Python Disabling Specific Instrumentations](Disabling Specific Instrumentations)
[OpenTelemetry Python Disabling Specific Instrumentations](https://opentelemetry.io/docs/zero-code/python/configuration/#disabling-specific-instrumentations)
9 changes: 8 additions & 1 deletion lambda-layer/src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM public.ecr.aws/sam/build-python3.12 AS python312
FROM public.ecr.aws/sam/build-python3.13 AS python313

ADD . /workspace

Expand All @@ -19,6 +19,13 @@ RUN mkdir -p /build && \
chmod 755 /build/otel-instrument && \
rm -rf /build/python/urllib3*

FROM public.ecr.aws/sam/build-python3.12 AS python312

WORKDIR /workspace

COPY --from=python313 /build /build

RUN python3 -m compileall /build/python

FROM public.ecr.aws/sam/build-python3.11 AS python311

Expand Down
2 changes: 1 addition & 1 deletion lambda-layer/terraform/lambda/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ locals {
resource "aws_lambda_layer_version" "sdk_layer" {
layer_name = var.sdk_layer_name
filename = "${path.module}/../../src/build/aws-opentelemetry-python-layer.zip"
compatible_runtimes = ["python3.10", "python3.11", "python3.12"]
compatible_runtimes = ["python3.10", "python3.11", "python3.12", "python3.13"]
license_info = "Apache-2.0"
source_code_hash = filebase64sha256("${path.module}/../../src/build/aws-opentelemetry-python-layer.zip")
}
Expand Down
10 changes: 2 additions & 8 deletions lambda-layer/terraform/lambda/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
variable "sdk_layer_name" {
type = string
description = "Name of published SDK layer"
default = "aws-opentelemetry-distro-python"
default = "AWSOpenTelemetryDistroPython"
}

variable "function_name" {
Expand All @@ -19,17 +19,11 @@ variable "architecture" {
variable "runtime" {
type = string
description = "Python runtime version used for sample Lambda Function"
default = "python3.12"
default = "python3.13"
}

variable "tracing_mode" {
type = string
description = "Lambda function tracing mode"
default = "Active"
}

variable "enable_collector_layer" {
type = bool
description = "Enables building and usage of a layer for the collector. If false, it means either the SDK layer includes the collector or it is not used."
default = false
}

0 comments on commit e628ecd

Please sign in to comment.