|
3 | 3 | Scripts and files used to build AWS Lambda Layers for running OpenTelemetry on AWS Lambda for Ruby. |
4 | 4 |
|
5 | 5 | **Requirement** |
6 | | -* [Ruby 3.2.0](https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-released/) (only supported version) |
| 6 | +* Ruby 3.2.0/3.3.0/3.4.0 |
7 | 7 | * [SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) |
8 | 8 | * [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) |
9 | 9 | * [Go](https://go.dev/doc/install) |
10 | 10 | * [Docker](https://docs.docker.com/get-docker) |
11 | 11 |
|
12 | 12 | **Building Lambda Ruby Layer With OpenTelemetry Ruby Dependencies** |
13 | 13 |
|
14 | | -1. Pull and install all the gem dependencies in to `.aws-sam` folder |
| 14 | +1. Run build script |
15 | 15 |
|
16 | 16 | ```bash |
17 | | -sam build -u -t template.yml |
| 17 | +./build.sh |
18 | 18 | ``` |
19 | 19 |
|
20 | | -2. Zip all the gems file, wrapper and handler into single zip file |
21 | | - |
22 | | -```bash |
23 | | -(cd .aws-sam/build/OTelLayer/ && zip -qr ../<your_layer_name>.zip .) |
24 | | -mv .aws-sam/build/<your_layer_name>.zip . |
25 | | - |
26 | | -# Or run the script |
27 | | -zip_ruby_layer.sh -n <your_layer_name> |
28 | | -``` |
| 20 | +Layer is stored in `src/build` folder |
29 | 21 |
|
30 | 22 | **Default GEM_PATH** |
31 | 23 |
|
@@ -70,21 +62,28 @@ For more information about aws lambda wrapper and wrapper layer, check [aws lamb |
70 | 62 |
|
71 | 63 | ### Sample App |
72 | 64 |
|
73 | | -1. Make sure the requirements are met (e.g. sam, aws, docker, ruby version.) |
74 | | -2. Navigate to the path `cd ruby/sample-apps` |
75 | | -3. Build the layer and function based on template.yml. You will see .aws-sam folder after executed the command |
| 65 | +1. Make sure the requirements are met (e.g. sam, aws, docker, ruby version.). Current sample app only support testing Ruby 3.2.0. If you wish to play with other ruby version, please modify ruby version from Runtime in sample-apps/template.yml and src/otel/layer/Makefile. |
| 66 | + |
| 67 | +2. Navigate to the path `cd ruby/src` to build layer |
| 68 | + |
| 69 | +```bash |
| 70 | +sam build -u -t template.yml |
| 71 | +``` |
| 72 | + |
| 73 | +3. Navigate to the path `cd ruby/sample-apps` |
| 74 | +4. Build the layer and function based on template.yml. You will see .aws-sam folder after executed the command |
76 | 75 | ```bash |
77 | 76 | sam build -u -t template.yml |
78 | 77 | # for different arch, define it in properties from template.yml |
79 | 78 | # Architectures: |
80 | 79 | # - arm64 |
81 | 80 | ``` |
82 | | -4. Test with local simulation |
| 81 | +5. Test with local simulation |
83 | 82 | ```bash |
84 | 83 | sam local start-api --skip-pull-image |
85 | 84 | ``` |
86 | 85 |
|
87 | | -5. curl the lambda function |
| 86 | +6. curl the lambda function |
88 | 87 | ```bash |
89 | 88 | curl http://127.0.0.1:3000 |
90 | 89 | # you should expect: Hello 1.4.1 |
|
0 commit comments