Skip to content

Commit

Permalink
Add Logz.io exporter and automated release workflow for OpenTelemetry…
Browse files Browse the repository at this point in the history
… Lambda Collector (#5)

* add exporter logzio

* update message for release
  • Loading branch information
bardabun authored Dec 16, 2024
1 parent 074cbf3 commit a7838a4
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 33 deletions.
32 changes: 14 additions & 18 deletions .github/workflows/layer-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ on:
workflow_call:
inputs:
artifact-name:
description: 'This should correspond to a actions/upload-artifact name earlier in the build. The file name and the name of the artifact containing it must be equal.'
description: "This should correspond to a actions/upload-artifact name earlier in the build. The file name and the name of the artifact containing it must be equal."
required: true
type: string
layer-name:
description: 'Layer name not including other parts like arch or version.'
description: "Layer name not including other parts like arch or version."
required: true
type: string
component-version:
description: 'Version of the component included in this release. Not the same as the layer/tagged version.'
description: "Version of the component included in this release. Not the same as the layer/tagged version."
required: true
type: string
architecture:
description: '(optional) amd64 or arm64'
description: "(optional) amd64 or arm64"
required: false
type: string
runtimes:
description: '(optional) a space delimited list of compatible runtimes (from https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html)'
description: "(optional) a space delimited list of compatible runtimes (from https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html)"
required: false
type: string
release-group:
Expand All @@ -29,49 +29,45 @@ on:
default: dev
type: string
aws_region:
description: 'Publish to which AWS region?'
description: "Publish to which AWS region?"
required: true
type: string


permissions:
id-token: write
contents: read

jobs:
publish_layer:
runs-on: ubuntu-latest

steps:

- name: Construct Layer Name
shell: bash
run: |
LAYER_NAME=${{ inputs.layer-name }}
if [[ -n "${{ inputs.architecture }}" ]]; then
LAYER_NAME=$LAYER_NAME-${{ inputs.architecture }}
ARCH=$(echo "${{ inputs.architecture }}" | sed -r 's/amd64/x86_64/g')
else
ARCH="x86_64 arm64"
fi
echo "ARCH=$ARCH" >> $GITHUB_ENV
if [[ -n "${{ inputs.runtimes }}" ]]; then
RUNTIMES="--compatible-runtimes ${{ inputs.runtimes }}"
fi
echo "RUNTIMES=$RUNTIMES" >> $GITHUB_ENV
if [[ "${{ inputs.release-group }}" != "prod" ]]; then
LAYER_NAME=$LAYER_NAME-${{ inputs.release-group }}
fi
LAYER_VERSION=$(echo "$GITHUB_REF_NAME" | sed -r 's/.*\/[^0-9\.]*//g')
LAYER_VERSION_CLEANED=$(echo "$LAYER_VERSION" | sed -r 's/\./_/g')
LAYER_NAME=$LAYER_NAME-$LAYER_VERSION_CLEANED
CLEAN_VERSION=$(echo "${{ inputs.component-version }}" | sed -r 's/\./_/g')
LAYER_NAME=$LAYER_NAME-$CLEAN_VERSION
echo "LAYER_NAME=$LAYER_NAME" >> $GITHUB_ENV
echo GITHUB_ENV:
cat $GITHUB_ENV
Expand Down
32 changes: 31 additions & 1 deletion .github/workflows/release-layer-collector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.23.1'
go-version: "^1.23.1"
- name: build
run: make -C collector package GOARCH=${{ matrix.architecture }}
- uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -87,3 +87,33 @@ jobs:
release-group: prod
aws_region: ${{ matrix.aws_region }}
secrets: inherit

update-release:
runs-on: ubuntu-latest
needs:
- publish-layer
- build-layer
steps:
- uses: actions/checkout@v4

- name: Append Layer ARNs to Release Body
run: |
COLLECTOR_VERSION=${{ needs.build-layer.outputs.COLLECTOR_VERSION }}
MESSAGE="### Lambda Layers for OpenTelemetry Collector (${COLLECTOR_VERSION})\n\n"
MESSAGE+="The following Lambda layers are available for this release. Use the appropriate ARN for your Lambda architecture:\n\n"
MESSAGE+="#### 🖥️ **amd64 (x86_64)**\n"
MESSAGE+="\`\`\`\n"
MESSAGE+="arn:aws:lambda:<region>:486140753397:layer:logzio-opentelemetry-collector-amd64-${COLLECTOR_VERSION//./_}:1\n"
MESSAGE+="\`\`\`\n\n"
MESSAGE+="#### 📱 **arm64**\n"
MESSAGE+="\`\`\`\n"
MESSAGE+="arn:aws:lambda:<region>:486140753397:layer:logzio-opentelemetry-collector-arm64-${COLLECTOR_VERSION//./_}:1\n"
MESSAGE+="\`\`\`\n\n"
# Append the message to the release notes
gh release view ${{ github.ref_name }} --json body -q .body > release_body.md
echo -e "\n$MESSAGE" >> release_body.md
gh release edit ${{ github.ref_name }} --notes-file release_body.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 10 additions & 2 deletions collector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ require (
github.com/alecthomas/participle/v2 v2.1.1 // indirect
github.com/antchfx/xmlquery v1.4.2 // indirect
github.com/antchfx/xpath v1.3.2 // indirect
github.com/apache/thrift v0.21.0 // indirect
github.com/aws/aws-sdk-go-v2 v1.32.3 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 // indirect
github.com/aws/aws-sdk-go-v2/config v1.28.1 // indirect
Expand Down Expand Up @@ -69,6 +70,7 @@ require (
github.com/elastic/go-grok v0.3.1 // indirect
github.com/elastic/lunes v0.1.0 // indirect
github.com/expr-lang/expr v1.16.9 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
Expand All @@ -83,27 +85,32 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jaegertracing/jaeger v1.62.0 // indirect
github.com/jonboulle/clockwork v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/knadh/koanf/maps v0.1.1 // indirect
github.com/knadh/koanf/providers/confmap v0.1.0 // indirect
github.com/knadh/koanf/v2 v2.1.1 // indirect
github.com/lightstep/go-expohisto v1.0.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect
github.com/magefile/mage v1.15.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mostynb/go-grpc-compression v1.2.3 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.113.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/logzioexporter v0.113.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.113.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/extension/basicauthextension v0.113.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/extension/sigv4authextension v0.113.0 // indirect
Expand All @@ -114,6 +121,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.113.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.113.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling v0.113.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.113.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.113.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.113.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.113.0 // indirect
Expand All @@ -126,7 +134,7 @@ require (
github.com/open-telemetry/opentelemetry-lambda/collector/receiver/telemetryapireceiver v0.98.0 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect
github.com/prometheus/client_golang v1.20.5 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.60.1 // indirect
Expand Down
Loading

0 comments on commit a7838a4

Please sign in to comment.