Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,10 @@ jobs:
mkdir -p "${GENERATED_DIR}"
envsubst '$REPO_NAME' < templates/.Dockerfile-lambda-template.tmpl | tee "${GENERATED_DIR}/Dockerfile.lambda"
envsubst < templates/.goreleaser-docker-lambda-template.yaml.tmpl | tee "${GENERATED_DIR}/.goreleaser.lambda.yaml"
# Copy collector config into caller repo for GoReleaser extra_files.
# Exclude from git to avoid dirty working tree detection.
cp collector.yaml ../_caller/collector.yaml
echo "collector.yaml" >> ../_caller/.git/info/exclude

- name: Docker Login
if: inputs.docker == true
Expand Down
29 changes: 29 additions & 0 deletions collector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# OpenTelemetry Collector configuration for Lambda connector extensions.
# The collector runs as a Lambda extension process, receiving telemetry from
# the connector via OTLP on localhost and forwarding it to the central
# collector before Lambda freezes or shuts down the execution environment.
receivers:
otlp:
protocols:
grpc:
endpoint: localhost:4317
http:
endpoint: localhost:4318

exporters:
otlp:
endpoint: otel-collector:4317
tls:
insecure_skip_verify: true

service:
pipelines:
traces:
receivers: [otlp]
exporters: [otlp]
metrics:
receivers: [otlp]
exporters: [otlp]
logs:
receivers: [otlp]
exporters: [otlp]
15 changes: 14 additions & 1 deletion templates/.Dockerfile-lambda-template.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Stage 1: Download and unpack the OpenTelemetry Collector Lambda extension
# https://github.com/open-telemetry/opentelemetry-lambda/tree/main/collector
FROM amazonlinux:2023 AS otel-layer
RUN yum install -y unzip && yum clean all
ADD https://github.com/open-telemetry/opentelemetry-lambda/releases/download/layer-collector%2F0.20.0/opentelemetry-collector-layer-arm64.zip /tmp/otel-layer.zip
RUN unzip /tmp/otel-layer.zip -d /otel && \
chmod +x /otel/extensions/collector && \
rm -f /tmp/otel-layer.zip

# Stage 2: Final Lambda image with connector binary + OTel collector extension
FROM public.ecr.aws/lambda/provided:al2023
COPY ${REPO_NAME} /${REPO_NAME}
COPY --from=otel-layer /otel/extensions/collector /opt/extensions/collector
COPY collector.yaml /var/task/collector.yaml
ENV OPENTELEMETRY_COLLECTOR_CONFIG_URI=/var/task/collector.yaml
ENTRYPOINT ["/${REPO_NAME}", "lambda"]
COPY ${REPO_NAME} /${REPO_NAME}
2 changes: 2 additions & 0 deletions templates/.goreleaser-docker-lambda-template.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ dockers:
dockerfile: ${DOCKERFILE_LAMBDA_PATH}
image_templates:
- "168442440833.dkr.ecr.us-west-2.amazonaws.com/${REPO_NAME}:{{ .Version }}-arm64"
extra_files:
- collector.yaml
build_flag_templates:
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand Down