-
Notifications
You must be signed in to change notification settings - Fork 57
/
patch-upstream.sh
executable file
·44 lines (31 loc) · 1.3 KB
/
patch-upstream.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -e
: <<'END_DOCUMENTATION'
`patch-upstream.sh`
This script patches the git submodule folder `opentelemetry-lambda` with ADOT
recommended configuration. The upstream repo is vendor agnostic, but we modify
it slightly to create Lambda Layers that should help OpenTelemetry users trace
their Lambdas with Lambda Layers configured to export to the X-Ray backend.
END_DOCUMENTATION
# Run unit tests on ADOT lambdacomponents
make --directory=adot/collector/lambdacomponents
# Patch some upstream components with ADOT specific components
cp -rf adot/* opentelemetry-lambda/
# Get current repo path
CURRENT_DIR=$PWD
# Move to the upstream OTel Lambda Collector folder where we will build a
# collector used in each Lambda layer
cd opentelemetry-lambda/collector
# patch otel version on collector/go.mod
PATCH_OTEL_VERSION="../../OTEL_Version.patch"
if [ -f $PATCH_OTEL_VERSION ]; then
patch -p2 < $PATCH_OTEL_VERSION;
fi
# patch collector startup to add httpsprovider
patch -p2 < ../../collector.patch
# patch manager.go to remove lambdacomponents attribute
patch -p2 < ../../manager.patch
# Replace OTel Collector with ADOT Collector
go mod edit -replace github.com/open-telemetry/opentelemetry-lambda/collector/lambdacomponents=${CURRENT_DIR}/adot/collector/lambdacomponents
rm -fr go.sum
go mod tidy