From b968ede9e5cd2f13fd235c60d38eba752eee8f1f Mon Sep 17 00:00:00 2001 From: kruskal <99559985+kruskall@users.noreply.github.com> Date: Mon, 22 Aug 2022 14:37:23 +0200 Subject: [PATCH 1/8] fix: update module name to use github url The previous module name was invalid and using a subfolder to store the source code was creating additional burden (e.g. you cannot 'git clone && make'. Update the module name to use the github url and flatten the directory structure. --- .gitignore | 2 + .../CHANGELOG.asciidoc => CHANGELOG.asciidoc | 0 .../CODE_OF_CONDUCT.md => CODE_OF_CONDUCT.md | 0 .../CONTRIBUTING.md => CONTRIBUTING.md | 0 apm-lambda-extension/Dockerfile => Dockerfile | 0 .../LICENSE.txt => LICENSE.txt | 0 apm-lambda-extension/Makefile => Makefile | 0 apm-lambda-extension/NOTICE.txt => NOTICE.txt | 0 README.md | 77 +++++++- apm-lambda-extension/RELEASE.md => RELEASE.md | 0 .../SECURITY.md => SECURITY.md | 0 apm-lambda-extension/.gitignore | 1 - apm-lambda-extension/README.md | 76 -------- .../apmproxy => apmproxy}/apmserver.go | 0 .../apmproxy => apmproxy}/apmserver_test.go | 0 .../apmproxy => apmproxy}/client.go | 0 .../apmproxy => apmproxy}/client_test.go | 0 .../apmproxy => apmproxy}/metadata.go | 0 .../apmproxy => apmproxy}/metadata_test.go | 0 .../apmproxy => apmproxy}/option.go | 0 .../apmproxy => apmproxy}/receiver.go | 0 .../apmproxy => apmproxy}/receiver_test.go | 0 .../apmproxy => apmproxy}/status.go | 0 {apm-lambda-extension/app => app}/app.go | 0 {apm-lambda-extension/app => app}/config.go | 0 {apm-lambda-extension/app => app}/run.go | 0 apm-lambda-extension/build.sh => build.sh | 0 .../cli => cli}/.eslintrc.js | 0 {apm-lambda-extension/cli => cli}/.gitignore | 0 {apm-lambda-extension/cli => cli}/README.md | 0 .../cli => cli}/build-and-publish.js | 0 .../cli => cli}/elastic-lambda.js | 0 {apm-lambda-extension/cli => cli}/install.js | 0 .../cli => cli}/install.yaml.dist | 0 .../cli => cli}/package-lock.json | 0 .../cli => cli}/package.json | 0 {apm-lambda-extension/cli => cli}/profile.js | 0 .../cli => cli}/profile.yaml.dist | 0 .../cli => cli}/profile/code/collector.yaml | 0 .../cli => cli}/profile/code/index.js | 0 .../cli => cli}/profile/elasticagent/index.js | 0 .../profile/elasticagent/package-lock.json | 0 .../profile/elasticagent/package.json | 0 .../cli => cli}/profile/noagent/index.js | 0 .../tests/build-and-publish.test.js | 0 .../cli => cli}/tests/profile.test.js | 0 .../cli => cli}/tests/update-layer.test.js | 0 .../cli => cli}/update-function-env.js | 0 .../cli => cli}/update-layer.js | 0 ...ndencies.asciidoc => dependencies.asciidoc | 0 .../.e2e_test_config | 0 .../e2e-testing => e2e-testing}/.gitignore | 0 .../e2e-testing => e2e-testing}/README.md | 0 .../e2e-testing => e2e-testing}/e2e_test.go | 0 .../e2e-testing => e2e-testing}/e2e_util.go | 0 .../sam-java/sam-testing-java/build.gradle | 0 .../sam-java/sam-testing-java/gradlew | 0 .../sam-java/sam-testing-java/gradlew.bat | 178 +++++++++--------- .../src/main/java/samtestingjava/App.java | 0 .../sam-java/template.yml | 0 .../sam-nodejs/sam-testing-nodejs/.npmignore | 0 .../sam-nodejs/sam-testing-nodejs/app.js | 0 .../sam-testing-nodejs/package.json | 0 .../sam-nodejs/template.yml | 0 .../sam-python/sam-testing-python/__init__.py | 0 .../sam-python/sam-testing-python/app.py | 0 .../sam-testing-python/requirements.txt | 0 .../sam-python/template.yml | 0 .../extension => extension}/client.go | 0 .../extension => extension}/client_test.go | 0 .../extension => extension}/process_env.go | 0 .../process_env_test.go | 0 .../extension => extension}/util.go | 0 .../extension => extension}/version.go | 0 apm-lambda-extension/go.mod => go.mod | 2 +- apm-lambda-extension/go.sum => go.sum | 0 .../logger => logger}/logger.go | 0 .../logger => logger}/logger_test.go | 0 .../logger => logger}/option.go | 0 .../logsapi => logsapi}/client.go | 0 .../logsapi => logsapi}/client_test.go | 0 .../logsapi => logsapi}/event.go | 0 .../logsapi => logsapi}/metrics.go | 0 .../logsapi => logsapi}/metrics_test.go | 0 .../logsapi => logsapi}/option.go | 0 .../logsapi => logsapi}/route_handlers.go | 0 .../route_handlers_test.go | 0 .../logsapi => logsapi}/subscribe.go | 0 apm-lambda-extension/main.go => main.go | 0 .../main_test.go => main_test.go | 0 .../scripts => scripts}/notice.sh | 0 .../overrides/overrides.json | 0 .../scripts => scripts}/rules.json | 0 .../templates/NOTICE.txt.tmpl | 0 .../templates/dependencies.asciidoc.tmpl | 0 95 files changed, 165 insertions(+), 171 deletions(-) rename apm-lambda-extension/CHANGELOG.asciidoc => CHANGELOG.asciidoc (100%) rename apm-lambda-extension/CODE_OF_CONDUCT.md => CODE_OF_CONDUCT.md (100%) rename apm-lambda-extension/CONTRIBUTING.md => CONTRIBUTING.md (100%) rename apm-lambda-extension/Dockerfile => Dockerfile (100%) rename apm-lambda-extension/LICENSE.txt => LICENSE.txt (100%) rename apm-lambda-extension/Makefile => Makefile (100%) rename apm-lambda-extension/NOTICE.txt => NOTICE.txt (100%) rename apm-lambda-extension/RELEASE.md => RELEASE.md (100%) rename apm-lambda-extension/SECURITY.md => SECURITY.md (100%) delete mode 100644 apm-lambda-extension/.gitignore delete mode 100644 apm-lambda-extension/README.md rename {apm-lambda-extension/apmproxy => apmproxy}/apmserver.go (100%) rename {apm-lambda-extension/apmproxy => apmproxy}/apmserver_test.go (100%) rename {apm-lambda-extension/apmproxy => apmproxy}/client.go (100%) rename {apm-lambda-extension/apmproxy => apmproxy}/client_test.go (100%) rename {apm-lambda-extension/apmproxy => apmproxy}/metadata.go (100%) rename {apm-lambda-extension/apmproxy => apmproxy}/metadata_test.go (100%) rename {apm-lambda-extension/apmproxy => apmproxy}/option.go (100%) rename {apm-lambda-extension/apmproxy => apmproxy}/receiver.go (100%) rename {apm-lambda-extension/apmproxy => apmproxy}/receiver_test.go (100%) rename {apm-lambda-extension/apmproxy => apmproxy}/status.go (100%) rename {apm-lambda-extension/app => app}/app.go (100%) rename {apm-lambda-extension/app => app}/config.go (100%) rename {apm-lambda-extension/app => app}/run.go (100%) rename apm-lambda-extension/build.sh => build.sh (100%) rename {apm-lambda-extension/cli => cli}/.eslintrc.js (100%) rename {apm-lambda-extension/cli => cli}/.gitignore (100%) rename {apm-lambda-extension/cli => cli}/README.md (100%) rename {apm-lambda-extension/cli => cli}/build-and-publish.js (100%) rename {apm-lambda-extension/cli => cli}/elastic-lambda.js (100%) rename {apm-lambda-extension/cli => cli}/install.js (100%) rename {apm-lambda-extension/cli => cli}/install.yaml.dist (100%) rename {apm-lambda-extension/cli => cli}/package-lock.json (100%) rename {apm-lambda-extension/cli => cli}/package.json (100%) rename {apm-lambda-extension/cli => cli}/profile.js (100%) rename {apm-lambda-extension/cli => cli}/profile.yaml.dist (100%) rename {apm-lambda-extension/cli => cli}/profile/code/collector.yaml (100%) rename {apm-lambda-extension/cli => cli}/profile/code/index.js (100%) rename {apm-lambda-extension/cli => cli}/profile/elasticagent/index.js (100%) rename {apm-lambda-extension/cli => cli}/profile/elasticagent/package-lock.json (100%) rename {apm-lambda-extension/cli => cli}/profile/elasticagent/package.json (100%) rename {apm-lambda-extension/cli => cli}/profile/noagent/index.js (100%) rename {apm-lambda-extension/cli => cli}/tests/build-and-publish.test.js (100%) rename {apm-lambda-extension/cli => cli}/tests/profile.test.js (100%) rename {apm-lambda-extension/cli => cli}/tests/update-layer.test.js (100%) rename {apm-lambda-extension/cli => cli}/update-function-env.js (100%) rename {apm-lambda-extension/cli => cli}/update-layer.js (100%) rename apm-lambda-extension/dependencies.asciidoc => dependencies.asciidoc (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/.e2e_test_config (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/.gitignore (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/README.md (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/e2e_test.go (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/e2e_util.go (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/sam-java/sam-testing-java/build.gradle (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/sam-java/sam-testing-java/gradlew (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/sam-java/sam-testing-java/gradlew.bat (96%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/sam-java/sam-testing-java/src/main/java/samtestingjava/App.java (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/sam-java/template.yml (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/sam-nodejs/sam-testing-nodejs/.npmignore (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/sam-nodejs/sam-testing-nodejs/app.js (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/sam-nodejs/sam-testing-nodejs/package.json (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/sam-nodejs/template.yml (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/sam-python/sam-testing-python/__init__.py (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/sam-python/sam-testing-python/app.py (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/sam-python/sam-testing-python/requirements.txt (100%) rename {apm-lambda-extension/e2e-testing => e2e-testing}/sam-python/template.yml (100%) rename {apm-lambda-extension/extension => extension}/client.go (100%) rename {apm-lambda-extension/extension => extension}/client_test.go (100%) rename {apm-lambda-extension/extension => extension}/process_env.go (100%) rename {apm-lambda-extension/extension => extension}/process_env_test.go (100%) rename {apm-lambda-extension/extension => extension}/util.go (100%) rename {apm-lambda-extension/extension => extension}/version.go (100%) rename apm-lambda-extension/go.mod => go.mod (97%) rename apm-lambda-extension/go.sum => go.sum (100%) rename {apm-lambda-extension/logger => logger}/logger.go (100%) rename {apm-lambda-extension/logger => logger}/logger_test.go (100%) rename {apm-lambda-extension/logger => logger}/option.go (100%) rename {apm-lambda-extension/logsapi => logsapi}/client.go (100%) rename {apm-lambda-extension/logsapi => logsapi}/client_test.go (100%) rename {apm-lambda-extension/logsapi => logsapi}/event.go (100%) rename {apm-lambda-extension/logsapi => logsapi}/metrics.go (100%) rename {apm-lambda-extension/logsapi => logsapi}/metrics_test.go (100%) rename {apm-lambda-extension/logsapi => logsapi}/option.go (100%) rename {apm-lambda-extension/logsapi => logsapi}/route_handlers.go (100%) rename {apm-lambda-extension/logsapi => logsapi}/route_handlers_test.go (100%) rename {apm-lambda-extension/logsapi => logsapi}/subscribe.go (100%) rename apm-lambda-extension/main.go => main.go (100%) rename apm-lambda-extension/main_test.go => main_test.go (100%) rename {apm-lambda-extension/scripts => scripts}/notice.sh (100%) rename {apm-lambda-extension/scripts => scripts}/overrides/overrides.json (100%) rename {apm-lambda-extension/scripts => scripts}/rules.json (100%) rename {apm-lambda-extension/scripts => scripts}/templates/NOTICE.txt.tmpl (100%) rename {apm-lambda-extension/scripts => scripts}/templates/dependencies.asciidoc.tmpl (100%) diff --git a/.gitignore b/.gitignore index 89c0ede3..ae5d3d40 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ # AWS regions file .regions .aws/ + +bin/ diff --git a/apm-lambda-extension/CHANGELOG.asciidoc b/CHANGELOG.asciidoc similarity index 100% rename from apm-lambda-extension/CHANGELOG.asciidoc rename to CHANGELOG.asciidoc diff --git a/apm-lambda-extension/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md similarity index 100% rename from apm-lambda-extension/CODE_OF_CONDUCT.md rename to CODE_OF_CONDUCT.md diff --git a/apm-lambda-extension/CONTRIBUTING.md b/CONTRIBUTING.md similarity index 100% rename from apm-lambda-extension/CONTRIBUTING.md rename to CONTRIBUTING.md diff --git a/apm-lambda-extension/Dockerfile b/Dockerfile similarity index 100% rename from apm-lambda-extension/Dockerfile rename to Dockerfile diff --git a/apm-lambda-extension/LICENSE.txt b/LICENSE.txt similarity index 100% rename from apm-lambda-extension/LICENSE.txt rename to LICENSE.txt diff --git a/apm-lambda-extension/Makefile b/Makefile similarity index 100% rename from apm-lambda-extension/Makefile rename to Makefile diff --git a/apm-lambda-extension/NOTICE.txt b/NOTICE.txt similarity index 100% rename from apm-lambda-extension/NOTICE.txt rename to NOTICE.txt diff --git a/README.md b/README.md index f22c08f3..0328ad49 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,86 @@ This repository contains code and tools for working with the Elastic APM AWS Lambda extension. +Elastic APM Agents can be used with AWS Lambda to monitor the execution of your AWS Lambda functions. +Currently the Node.js, Python and Java Agents are supported. + +The extension listens for data once per function invocation and forwards data to an APM Server. + ## Documentation Ready to use Elastic APM to monitor your Lambda functions? See [Monitoring AWS Lambda Functions](https://www.elastic.co/guide/en/apm/guide/current/monitoring-aws-lambda.html) to get started. Backport any changes made in the `docs` directory to the branches that you'd like to see the docs show up in. Branch names must follow the `major.minor` naming scheme and match a new or recent Elastic Stack version. -## License - -Apache 2.0. - ## Getting Help If you find a bug, please [report an issue](https://github.com/elastic/apm-agent-go/issues). For any other assistance, please open or add to a topic on the [APM discuss forum](https://discuss.elastic.co/c/apm). + +## Contributing + +See [contributing](CONTRIBUTING.md) for details about reporting bugs, requesting features, or code contributions. + +## Testing unreleased versions +If you need to test an unreleased version you can compile the package and it's dependencies and make them available as AWS Lambda Layer. + +### Compile package and dependencies + +To run an unreleased version of this extension, you will need to ensure that your build architecture matches that of the Lambda execution environment by compiling with `GOOS=linux` and `GOARCH=amd64` if you are not running in a Linux environment. + +To build the extension into the `bin/extensions` folder, run the following commands. + +```bash +$ cd apm-lambda-extension +$ GOOS=linux GOARCH=amd64 go build -o bin/extensions/apm-lambda-extension main.go +$ chmod +x bin/extensions/apm-lambda-extension +``` + +### Layer Setup Process + +Once you've compiled the extension, the next step is to make it available as an AWS Lambda Layer. In order to do this we'll need to create a zip file with the extension binary, and then use the `lambda publish-layer-version` command/sub-command of the AWS CLI. + +The extensions .zip file should contain a root directory called `extensions/`, where the extension executables are located. In this sample project we must include the `apm-lambda-extension` binary. + +To create the zip file, run the following commands from the root of your project folder. + +```bash +$ cd apm-lambda-extension/bin +$ zip -r extension.zip extensions/ +``` + +To publish the zip file as a layer, run the following command using the AWS cli (presumes you have v2 of the aws-cli installed). + +Ensure that you have aws-cli v2 for the commands below. +Publish a new layer using the `extension.zip`. The output of the following command should provide you a layer arn. + +```bash +aws lambda publish-layer-version \ + --layer-name "apm-lambda-extension" \ + --region \ + --zip-file "fileb://extension.zip" +``` + +The out from the above command will include a `LayverVersionArn` field, which contains the unique string identifier for your layer. The will look something like the following. + + `"LayerVersionArn": "arn:aws:lambda::123456789012:layer::1"` + +This is the string you'll enter in the AWS Lambda Console to add this layer to your Lambda function. + +### One Step Build + +The `Makefile` also provides a `build-and-publish` command which will perform the above steps for use, using ENV variable for credentials and other information. + + $ ELASTIC_LAYER_NAME=apm-lambda-extension \ + AWS_DEFAULT_REGION=us-west-2 \ + AWS_ACCESS_KEY_ID=A...X \ + AWS_SECRET_ACCESS_KEY=h...E \ + make build-and-publish + +## Release Procedure + +See [release](RELEASE.md) for details. + +## License + +Apache 2.0. diff --git a/apm-lambda-extension/RELEASE.md b/RELEASE.md similarity index 100% rename from apm-lambda-extension/RELEASE.md rename to RELEASE.md diff --git a/apm-lambda-extension/SECURITY.md b/SECURITY.md similarity index 100% rename from apm-lambda-extension/SECURITY.md rename to SECURITY.md diff --git a/apm-lambda-extension/.gitignore b/apm-lambda-extension/.gitignore deleted file mode 100644 index e660fd93..00000000 --- a/apm-lambda-extension/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bin/ diff --git a/apm-lambda-extension/README.md b/apm-lambda-extension/README.md deleted file mode 100644 index 3ff9957b..00000000 --- a/apm-lambda-extension/README.md +++ /dev/null @@ -1,76 +0,0 @@ -[![Build Status](https://apm-ci.elastic.co/buildStatus/icon?job=library%2Fapm-aws-lambda-mbp%2Fmain)](https://apm-ci.elastic.co/job/library/job/apm-aws-lambda-mbp/job/main/) - -# Elastic APM AWS Lambda extension - -Elastic APM Agents can be used with AWS Lambda to monitor the execution of your AWS Lambda functions. -Currently the Node.js, Python and Java Agents are supported. - -The extension listens for data once per function invocation and forwards data to an APM Server. - -## Getting Started -Ready to use Elastic APM to monitor your Lambda functions? -See [Monitoring AWS Lambda Functions](https://www.elastic.co/guide/en/apm/guide/current/monitoring-aws-lambda.html) to get started and learn more about available configuration options. - -## Contributing - -See [contributing](CONTRIBUTING.md) for details about reporting bugs, requesting features, or code contributions. - -## Testing unreleased versions -If you need to test an unreleased version you can compile the package and it's dependencies and make them available as AWS Lambda Layer. - -### Compile package and dependencies - -To run an unreleased version of this extension, you will need to ensure that your build architecture matches that of the Lambda execution environment by compiling with `GOOS=linux` and `GOARCH=amd64` if you are not running in a Linux environment. - -To build the extension into the `bin/extensions` folder, run the following commands. - -```bash -$ cd apm-lambda-extension -$ GOOS=linux GOARCH=amd64 go build -o bin/extensions/apm-lambda-extension main.go -$ chmod +x bin/extensions/apm-lambda-extension -``` - -### Layer Setup Process - -Once you've compiled the extension, the next step is to make it available as an AWS Lambda Layer. In order to do this we'll need to create a zip file with the extension binary, and then use the `lambda publish-layer-version` command/sub-command of the AWS CLI. - -The extensions .zip file should contain a root directory called `extensions/`, where the extension executables are located. In this sample project we must include the `apm-lambda-extension` binary. - -To create the zip file, run the following commands from the root of your project folder. - -```bash -$ cd apm-lambda-extension/bin -$ zip -r extension.zip extensions/ -``` - -To publish the zip file as a layer, run the following command using the AWS cli (presumes you have v2 of the aws-cli installed). - -Ensure that you have aws-cli v2 for the commands below. -Publish a new layer using the `extension.zip`. The output of the following command should provide you a layer arn. - -```bash -aws lambda publish-layer-version \ - --layer-name "apm-lambda-extension" \ - --region \ - --zip-file "fileb://extension.zip" -``` - -The out from the above command will include a `LayverVersionArn` field, which contains the unique string identifier for your layer. The will look something like the following. - - `"LayerVersionArn": "arn:aws:lambda::123456789012:layer::1"` - -This is the string you'll enter in the AWS Lambda Console to add this layer to your Lambda function. - -### One Step Build - -The `Makefile` also provides a `build-and-publish` command which will perform the above steps for use, using ENV variable for credentials and other information. - - $ ELASTIC_LAYER_NAME=apm-lambda-extension \ - AWS_DEFAULT_REGION=us-west-2 \ - AWS_ACCESS_KEY_ID=A...X \ - AWS_SECRET_ACCESS_KEY=h...E \ - make build-and-publish - -## Release Procedure - -See [release](RELEASE.md) for details. \ No newline at end of file diff --git a/apm-lambda-extension/apmproxy/apmserver.go b/apmproxy/apmserver.go similarity index 100% rename from apm-lambda-extension/apmproxy/apmserver.go rename to apmproxy/apmserver.go diff --git a/apm-lambda-extension/apmproxy/apmserver_test.go b/apmproxy/apmserver_test.go similarity index 100% rename from apm-lambda-extension/apmproxy/apmserver_test.go rename to apmproxy/apmserver_test.go diff --git a/apm-lambda-extension/apmproxy/client.go b/apmproxy/client.go similarity index 100% rename from apm-lambda-extension/apmproxy/client.go rename to apmproxy/client.go diff --git a/apm-lambda-extension/apmproxy/client_test.go b/apmproxy/client_test.go similarity index 100% rename from apm-lambda-extension/apmproxy/client_test.go rename to apmproxy/client_test.go diff --git a/apm-lambda-extension/apmproxy/metadata.go b/apmproxy/metadata.go similarity index 100% rename from apm-lambda-extension/apmproxy/metadata.go rename to apmproxy/metadata.go diff --git a/apm-lambda-extension/apmproxy/metadata_test.go b/apmproxy/metadata_test.go similarity index 100% rename from apm-lambda-extension/apmproxy/metadata_test.go rename to apmproxy/metadata_test.go diff --git a/apm-lambda-extension/apmproxy/option.go b/apmproxy/option.go similarity index 100% rename from apm-lambda-extension/apmproxy/option.go rename to apmproxy/option.go diff --git a/apm-lambda-extension/apmproxy/receiver.go b/apmproxy/receiver.go similarity index 100% rename from apm-lambda-extension/apmproxy/receiver.go rename to apmproxy/receiver.go diff --git a/apm-lambda-extension/apmproxy/receiver_test.go b/apmproxy/receiver_test.go similarity index 100% rename from apm-lambda-extension/apmproxy/receiver_test.go rename to apmproxy/receiver_test.go diff --git a/apm-lambda-extension/apmproxy/status.go b/apmproxy/status.go similarity index 100% rename from apm-lambda-extension/apmproxy/status.go rename to apmproxy/status.go diff --git a/apm-lambda-extension/app/app.go b/app/app.go similarity index 100% rename from apm-lambda-extension/app/app.go rename to app/app.go diff --git a/apm-lambda-extension/app/config.go b/app/config.go similarity index 100% rename from apm-lambda-extension/app/config.go rename to app/config.go diff --git a/apm-lambda-extension/app/run.go b/app/run.go similarity index 100% rename from apm-lambda-extension/app/run.go rename to app/run.go diff --git a/apm-lambda-extension/build.sh b/build.sh similarity index 100% rename from apm-lambda-extension/build.sh rename to build.sh diff --git a/apm-lambda-extension/cli/.eslintrc.js b/cli/.eslintrc.js similarity index 100% rename from apm-lambda-extension/cli/.eslintrc.js rename to cli/.eslintrc.js diff --git a/apm-lambda-extension/cli/.gitignore b/cli/.gitignore similarity index 100% rename from apm-lambda-extension/cli/.gitignore rename to cli/.gitignore diff --git a/apm-lambda-extension/cli/README.md b/cli/README.md similarity index 100% rename from apm-lambda-extension/cli/README.md rename to cli/README.md diff --git a/apm-lambda-extension/cli/build-and-publish.js b/cli/build-and-publish.js similarity index 100% rename from apm-lambda-extension/cli/build-and-publish.js rename to cli/build-and-publish.js diff --git a/apm-lambda-extension/cli/elastic-lambda.js b/cli/elastic-lambda.js similarity index 100% rename from apm-lambda-extension/cli/elastic-lambda.js rename to cli/elastic-lambda.js diff --git a/apm-lambda-extension/cli/install.js b/cli/install.js similarity index 100% rename from apm-lambda-extension/cli/install.js rename to cli/install.js diff --git a/apm-lambda-extension/cli/install.yaml.dist b/cli/install.yaml.dist similarity index 100% rename from apm-lambda-extension/cli/install.yaml.dist rename to cli/install.yaml.dist diff --git a/apm-lambda-extension/cli/package-lock.json b/cli/package-lock.json similarity index 100% rename from apm-lambda-extension/cli/package-lock.json rename to cli/package-lock.json diff --git a/apm-lambda-extension/cli/package.json b/cli/package.json similarity index 100% rename from apm-lambda-extension/cli/package.json rename to cli/package.json diff --git a/apm-lambda-extension/cli/profile.js b/cli/profile.js similarity index 100% rename from apm-lambda-extension/cli/profile.js rename to cli/profile.js diff --git a/apm-lambda-extension/cli/profile.yaml.dist b/cli/profile.yaml.dist similarity index 100% rename from apm-lambda-extension/cli/profile.yaml.dist rename to cli/profile.yaml.dist diff --git a/apm-lambda-extension/cli/profile/code/collector.yaml b/cli/profile/code/collector.yaml similarity index 100% rename from apm-lambda-extension/cli/profile/code/collector.yaml rename to cli/profile/code/collector.yaml diff --git a/apm-lambda-extension/cli/profile/code/index.js b/cli/profile/code/index.js similarity index 100% rename from apm-lambda-extension/cli/profile/code/index.js rename to cli/profile/code/index.js diff --git a/apm-lambda-extension/cli/profile/elasticagent/index.js b/cli/profile/elasticagent/index.js similarity index 100% rename from apm-lambda-extension/cli/profile/elasticagent/index.js rename to cli/profile/elasticagent/index.js diff --git a/apm-lambda-extension/cli/profile/elasticagent/package-lock.json b/cli/profile/elasticagent/package-lock.json similarity index 100% rename from apm-lambda-extension/cli/profile/elasticagent/package-lock.json rename to cli/profile/elasticagent/package-lock.json diff --git a/apm-lambda-extension/cli/profile/elasticagent/package.json b/cli/profile/elasticagent/package.json similarity index 100% rename from apm-lambda-extension/cli/profile/elasticagent/package.json rename to cli/profile/elasticagent/package.json diff --git a/apm-lambda-extension/cli/profile/noagent/index.js b/cli/profile/noagent/index.js similarity index 100% rename from apm-lambda-extension/cli/profile/noagent/index.js rename to cli/profile/noagent/index.js diff --git a/apm-lambda-extension/cli/tests/build-and-publish.test.js b/cli/tests/build-and-publish.test.js similarity index 100% rename from apm-lambda-extension/cli/tests/build-and-publish.test.js rename to cli/tests/build-and-publish.test.js diff --git a/apm-lambda-extension/cli/tests/profile.test.js b/cli/tests/profile.test.js similarity index 100% rename from apm-lambda-extension/cli/tests/profile.test.js rename to cli/tests/profile.test.js diff --git a/apm-lambda-extension/cli/tests/update-layer.test.js b/cli/tests/update-layer.test.js similarity index 100% rename from apm-lambda-extension/cli/tests/update-layer.test.js rename to cli/tests/update-layer.test.js diff --git a/apm-lambda-extension/cli/update-function-env.js b/cli/update-function-env.js similarity index 100% rename from apm-lambda-extension/cli/update-function-env.js rename to cli/update-function-env.js diff --git a/apm-lambda-extension/cli/update-layer.js b/cli/update-layer.js similarity index 100% rename from apm-lambda-extension/cli/update-layer.js rename to cli/update-layer.js diff --git a/apm-lambda-extension/dependencies.asciidoc b/dependencies.asciidoc similarity index 100% rename from apm-lambda-extension/dependencies.asciidoc rename to dependencies.asciidoc diff --git a/apm-lambda-extension/e2e-testing/.e2e_test_config b/e2e-testing/.e2e_test_config similarity index 100% rename from apm-lambda-extension/e2e-testing/.e2e_test_config rename to e2e-testing/.e2e_test_config diff --git a/apm-lambda-extension/e2e-testing/.gitignore b/e2e-testing/.gitignore similarity index 100% rename from apm-lambda-extension/e2e-testing/.gitignore rename to e2e-testing/.gitignore diff --git a/apm-lambda-extension/e2e-testing/README.md b/e2e-testing/README.md similarity index 100% rename from apm-lambda-extension/e2e-testing/README.md rename to e2e-testing/README.md diff --git a/apm-lambda-extension/e2e-testing/e2e_test.go b/e2e-testing/e2e_test.go similarity index 100% rename from apm-lambda-extension/e2e-testing/e2e_test.go rename to e2e-testing/e2e_test.go diff --git a/apm-lambda-extension/e2e-testing/e2e_util.go b/e2e-testing/e2e_util.go similarity index 100% rename from apm-lambda-extension/e2e-testing/e2e_util.go rename to e2e-testing/e2e_util.go diff --git a/apm-lambda-extension/e2e-testing/sam-java/sam-testing-java/build.gradle b/e2e-testing/sam-java/sam-testing-java/build.gradle similarity index 100% rename from apm-lambda-extension/e2e-testing/sam-java/sam-testing-java/build.gradle rename to e2e-testing/sam-java/sam-testing-java/build.gradle diff --git a/apm-lambda-extension/e2e-testing/sam-java/sam-testing-java/gradlew b/e2e-testing/sam-java/sam-testing-java/gradlew similarity index 100% rename from apm-lambda-extension/e2e-testing/sam-java/sam-testing-java/gradlew rename to e2e-testing/sam-java/sam-testing-java/gradlew diff --git a/apm-lambda-extension/e2e-testing/sam-java/sam-testing-java/gradlew.bat b/e2e-testing/sam-java/sam-testing-java/gradlew.bat similarity index 96% rename from apm-lambda-extension/e2e-testing/sam-java/sam-testing-java/gradlew.bat rename to e2e-testing/sam-java/sam-testing-java/gradlew.bat index ac1b06f9..107acd32 100644 --- a/apm-lambda-extension/e2e-testing/sam-java/sam-testing-java/gradlew.bat +++ b/e2e-testing/sam-java/sam-testing-java/gradlew.bat @@ -1,89 +1,89 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/apm-lambda-extension/e2e-testing/sam-java/sam-testing-java/src/main/java/samtestingjava/App.java b/e2e-testing/sam-java/sam-testing-java/src/main/java/samtestingjava/App.java similarity index 100% rename from apm-lambda-extension/e2e-testing/sam-java/sam-testing-java/src/main/java/samtestingjava/App.java rename to e2e-testing/sam-java/sam-testing-java/src/main/java/samtestingjava/App.java diff --git a/apm-lambda-extension/e2e-testing/sam-java/template.yml b/e2e-testing/sam-java/template.yml similarity index 100% rename from apm-lambda-extension/e2e-testing/sam-java/template.yml rename to e2e-testing/sam-java/template.yml diff --git a/apm-lambda-extension/e2e-testing/sam-nodejs/sam-testing-nodejs/.npmignore b/e2e-testing/sam-nodejs/sam-testing-nodejs/.npmignore similarity index 100% rename from apm-lambda-extension/e2e-testing/sam-nodejs/sam-testing-nodejs/.npmignore rename to e2e-testing/sam-nodejs/sam-testing-nodejs/.npmignore diff --git a/apm-lambda-extension/e2e-testing/sam-nodejs/sam-testing-nodejs/app.js b/e2e-testing/sam-nodejs/sam-testing-nodejs/app.js similarity index 100% rename from apm-lambda-extension/e2e-testing/sam-nodejs/sam-testing-nodejs/app.js rename to e2e-testing/sam-nodejs/sam-testing-nodejs/app.js diff --git a/apm-lambda-extension/e2e-testing/sam-nodejs/sam-testing-nodejs/package.json b/e2e-testing/sam-nodejs/sam-testing-nodejs/package.json similarity index 100% rename from apm-lambda-extension/e2e-testing/sam-nodejs/sam-testing-nodejs/package.json rename to e2e-testing/sam-nodejs/sam-testing-nodejs/package.json diff --git a/apm-lambda-extension/e2e-testing/sam-nodejs/template.yml b/e2e-testing/sam-nodejs/template.yml similarity index 100% rename from apm-lambda-extension/e2e-testing/sam-nodejs/template.yml rename to e2e-testing/sam-nodejs/template.yml diff --git a/apm-lambda-extension/e2e-testing/sam-python/sam-testing-python/__init__.py b/e2e-testing/sam-python/sam-testing-python/__init__.py similarity index 100% rename from apm-lambda-extension/e2e-testing/sam-python/sam-testing-python/__init__.py rename to e2e-testing/sam-python/sam-testing-python/__init__.py diff --git a/apm-lambda-extension/e2e-testing/sam-python/sam-testing-python/app.py b/e2e-testing/sam-python/sam-testing-python/app.py similarity index 100% rename from apm-lambda-extension/e2e-testing/sam-python/sam-testing-python/app.py rename to e2e-testing/sam-python/sam-testing-python/app.py diff --git a/apm-lambda-extension/e2e-testing/sam-python/sam-testing-python/requirements.txt b/e2e-testing/sam-python/sam-testing-python/requirements.txt similarity index 100% rename from apm-lambda-extension/e2e-testing/sam-python/sam-testing-python/requirements.txt rename to e2e-testing/sam-python/sam-testing-python/requirements.txt diff --git a/apm-lambda-extension/e2e-testing/sam-python/template.yml b/e2e-testing/sam-python/template.yml similarity index 100% rename from apm-lambda-extension/e2e-testing/sam-python/template.yml rename to e2e-testing/sam-python/template.yml diff --git a/apm-lambda-extension/extension/client.go b/extension/client.go similarity index 100% rename from apm-lambda-extension/extension/client.go rename to extension/client.go diff --git a/apm-lambda-extension/extension/client_test.go b/extension/client_test.go similarity index 100% rename from apm-lambda-extension/extension/client_test.go rename to extension/client_test.go diff --git a/apm-lambda-extension/extension/process_env.go b/extension/process_env.go similarity index 100% rename from apm-lambda-extension/extension/process_env.go rename to extension/process_env.go diff --git a/apm-lambda-extension/extension/process_env_test.go b/extension/process_env_test.go similarity index 100% rename from apm-lambda-extension/extension/process_env_test.go rename to extension/process_env_test.go diff --git a/apm-lambda-extension/extension/util.go b/extension/util.go similarity index 100% rename from apm-lambda-extension/extension/util.go rename to extension/util.go diff --git a/apm-lambda-extension/extension/version.go b/extension/version.go similarity index 100% rename from apm-lambda-extension/extension/version.go rename to extension/version.go diff --git a/apm-lambda-extension/go.mod b/go.mod similarity index 97% rename from apm-lambda-extension/go.mod rename to go.mod index 4ca6edb4..1dd77f6f 100644 --- a/apm-lambda-extension/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module elastic/apm-lambda-extension +module github.com/elastic/apm-aws-lambda go 1.19 diff --git a/apm-lambda-extension/go.sum b/go.sum similarity index 100% rename from apm-lambda-extension/go.sum rename to go.sum diff --git a/apm-lambda-extension/logger/logger.go b/logger/logger.go similarity index 100% rename from apm-lambda-extension/logger/logger.go rename to logger/logger.go diff --git a/apm-lambda-extension/logger/logger_test.go b/logger/logger_test.go similarity index 100% rename from apm-lambda-extension/logger/logger_test.go rename to logger/logger_test.go diff --git a/apm-lambda-extension/logger/option.go b/logger/option.go similarity index 100% rename from apm-lambda-extension/logger/option.go rename to logger/option.go diff --git a/apm-lambda-extension/logsapi/client.go b/logsapi/client.go similarity index 100% rename from apm-lambda-extension/logsapi/client.go rename to logsapi/client.go diff --git a/apm-lambda-extension/logsapi/client_test.go b/logsapi/client_test.go similarity index 100% rename from apm-lambda-extension/logsapi/client_test.go rename to logsapi/client_test.go diff --git a/apm-lambda-extension/logsapi/event.go b/logsapi/event.go similarity index 100% rename from apm-lambda-extension/logsapi/event.go rename to logsapi/event.go diff --git a/apm-lambda-extension/logsapi/metrics.go b/logsapi/metrics.go similarity index 100% rename from apm-lambda-extension/logsapi/metrics.go rename to logsapi/metrics.go diff --git a/apm-lambda-extension/logsapi/metrics_test.go b/logsapi/metrics_test.go similarity index 100% rename from apm-lambda-extension/logsapi/metrics_test.go rename to logsapi/metrics_test.go diff --git a/apm-lambda-extension/logsapi/option.go b/logsapi/option.go similarity index 100% rename from apm-lambda-extension/logsapi/option.go rename to logsapi/option.go diff --git a/apm-lambda-extension/logsapi/route_handlers.go b/logsapi/route_handlers.go similarity index 100% rename from apm-lambda-extension/logsapi/route_handlers.go rename to logsapi/route_handlers.go diff --git a/apm-lambda-extension/logsapi/route_handlers_test.go b/logsapi/route_handlers_test.go similarity index 100% rename from apm-lambda-extension/logsapi/route_handlers_test.go rename to logsapi/route_handlers_test.go diff --git a/apm-lambda-extension/logsapi/subscribe.go b/logsapi/subscribe.go similarity index 100% rename from apm-lambda-extension/logsapi/subscribe.go rename to logsapi/subscribe.go diff --git a/apm-lambda-extension/main.go b/main.go similarity index 100% rename from apm-lambda-extension/main.go rename to main.go diff --git a/apm-lambda-extension/main_test.go b/main_test.go similarity index 100% rename from apm-lambda-extension/main_test.go rename to main_test.go diff --git a/apm-lambda-extension/scripts/notice.sh b/scripts/notice.sh similarity index 100% rename from apm-lambda-extension/scripts/notice.sh rename to scripts/notice.sh diff --git a/apm-lambda-extension/scripts/overrides/overrides.json b/scripts/overrides/overrides.json similarity index 100% rename from apm-lambda-extension/scripts/overrides/overrides.json rename to scripts/overrides/overrides.json diff --git a/apm-lambda-extension/scripts/rules.json b/scripts/rules.json similarity index 100% rename from apm-lambda-extension/scripts/rules.json rename to scripts/rules.json diff --git a/apm-lambda-extension/scripts/templates/NOTICE.txt.tmpl b/scripts/templates/NOTICE.txt.tmpl similarity index 100% rename from apm-lambda-extension/scripts/templates/NOTICE.txt.tmpl rename to scripts/templates/NOTICE.txt.tmpl diff --git a/apm-lambda-extension/scripts/templates/dependencies.asciidoc.tmpl b/scripts/templates/dependencies.asciidoc.tmpl similarity index 100% rename from apm-lambda-extension/scripts/templates/dependencies.asciidoc.tmpl rename to scripts/templates/dependencies.asciidoc.tmpl From 6534e63933d184573026288453c77ec8bd240a8a Mon Sep 17 00:00:00 2001 From: kruskal <99559985+kruskall@users.noreply.github.com> Date: Mon, 22 Aug 2022 14:54:26 +0200 Subject: [PATCH 2/8] ci: update jenkinsfile to use new source path --- .ci/Jenkinsfile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index be1bf45f..787e7e53 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -45,7 +45,7 @@ pipeline { steps { withGithubNotify(context: "Lint") { withGoEnv(){ - dir("${BASE_DIR}/apm-lambda-extension"){ + dir("${BASE_DIR}"){ sh(label: 'lint-prep', script: 'go mod tidy && git diff --exit-code') sh(label: 'lint-run', script: 'make lint') sh(label: 'Go vet', script: 'go vet') @@ -54,7 +54,7 @@ pipeline { } withGithubNotify(context: "NOTICE.txt") { withGoEnv(){ - dir("${BASE_DIR}/apm-lambda-extension"){ + dir("${BASE_DIR}"){ sh(label: 'notice', script: ''' make NOTICE.txt git diff --exit-code --quiet && exit 0 || echo "regenerate NOTICE.txt" && exit 1 @@ -82,7 +82,7 @@ pipeline { deleteDir() unstash 'source' withGoEnv(){ - dir("${BASE_DIR}/apm-lambda-extension"){ + dir("${BASE_DIR}"){ cmd(label: 'make build', script: 'make build') } } @@ -93,7 +93,7 @@ pipeline { steps { withGithubNotify(context: "Test-${GO_VERSION}-${PLATFORM}") { withGoEnv(){ - dir("${BASE_DIR}/apm-lambda-extension"){ + dir("${BASE_DIR}"){ goTestJUnit(options: '-v ./...', output: 'junit-report.xml') } } @@ -135,7 +135,7 @@ pipeline { deleteDir() unstash 'source' withGoEnv(){ - dir("${BASE_DIR}/apm-lambda-extension"){ + dir("${BASE_DIR}"){ cmd(label: 'make dist', script: 'make dist') } } @@ -146,7 +146,7 @@ pipeline { steps { withGithubNotify(context: "Push-Docker-${PLATFORM}") { withGoEnv(){ - dir("${BASE_DIR}/apm-lambda-extension"){ + dir("${BASE_DIR}"){ dockerLogin(secret: "${DOCKER_SECRET}", registry: "${DOCKER_REGISTRY}") cmd(label: 'make push-docker', script: 'make push-docker') } @@ -159,7 +159,7 @@ pipeline { withGithubNotify(context: "Publish-Layer-${PLATFORM}") { withGoEnv(){ withAWSEnv(secret: 'secret/observability-team/ci/service-account/apm-aws-lambda', forceInstallation: true, version: '2.4.10') { - dir("${BASE_DIR}/apm-lambda-extension"){ + dir("${BASE_DIR}"){ cmd(label: 'make publish-in-all-aws-regions', script: 'make publish-in-all-aws-regions') cmd(label: 'make create-arn-file', script: 'make create-arn-file') stash(includes: "*${SUFFIX_ARN_FILE}", name: "arn-${isArm() ? 'arm' : 'amd'}") @@ -171,9 +171,9 @@ pipeline { } post { always { - archiveArtifacts(allowEmptyArchive: true, artifacts: "${BASE_DIR}/apm-lambda-extension/.regions") - archiveArtifacts(allowEmptyArchive: true, artifacts: "${BASE_DIR}/apm-lambda-extension/*${SUFFIX_ARN_FILE}") - archiveArtifacts(allowEmptyArchive: true, artifacts: "${BASE_DIR}/apm-lambda-extension/.aws") + archiveArtifacts(allowEmptyArchive: true, artifacts: "${BASE_DIR}/.regions") + archiveArtifacts(allowEmptyArchive: true, artifacts: "${BASE_DIR}/*${SUFFIX_ARN_FILE}") + archiveArtifacts(allowEmptyArchive: true, artifacts: "${BASE_DIR}/.aws") } } } @@ -183,7 +183,7 @@ pipeline { stage('Release Notes') { steps { withGhEnv(forceInstallation: true, version: '2.4.0') { - dir("${BASE_DIR}/apm-lambda-extension"){ + dir("${BASE_DIR}"){ unstash "arn-arm" unstash "arn-amd" unstash "dist-arm" From 28fe14a8c289637e6d81100018c5eb73fad7a1a4 Mon Sep 17 00:00:00 2001 From: kruskal <99559985+kruskall@users.noreply.github.com> Date: Mon, 22 Aug 2022 15:02:38 +0200 Subject: [PATCH 3/8] fix: update imports module name --- apmproxy/apmserver_test.go | 2 +- apmproxy/client_test.go | 2 +- apmproxy/metadata_test.go | 2 +- apmproxy/receiver_test.go | 2 +- app/app.go | 8 ++++---- app/run.go | 6 +++--- e2e-testing/e2e_test.go | 2 +- e2e-testing/e2e_util.go | 2 +- extension/process_env.go | 2 +- logger/logger_test.go | 2 +- logsapi/client_test.go | 2 +- logsapi/event.go | 4 ++-- logsapi/metrics.go | 5 ++--- logsapi/metrics_test.go | 4 ++-- main.go | 2 +- main_test.go | 10 +++++----- 16 files changed, 28 insertions(+), 29 deletions(-) diff --git a/apmproxy/apmserver_test.go b/apmproxy/apmserver_test.go index e6534a4b..3e5cc952 100644 --- a/apmproxy/apmserver_test.go +++ b/apmproxy/apmserver_test.go @@ -20,7 +20,7 @@ package apmproxy_test import ( "compress/gzip" "context" - "elastic/apm-lambda-extension/apmproxy" + "github.com/elastic/apm-aws-lambda/apmproxy" "io" "net/http" "net/http/httptest" diff --git a/apmproxy/client_test.go b/apmproxy/client_test.go index ae4e05f9..8dd75d36 100644 --- a/apmproxy/client_test.go +++ b/apmproxy/client_test.go @@ -18,7 +18,7 @@ package apmproxy_test import ( - "elastic/apm-lambda-extension/apmproxy" + "github.com/elastic/apm-aws-lambda/apmproxy" "testing" "github.com/stretchr/testify/require" diff --git a/apmproxy/metadata_test.go b/apmproxy/metadata_test.go index 6ac647e1..be88a0f3 100644 --- a/apmproxy/metadata_test.go +++ b/apmproxy/metadata_test.go @@ -21,7 +21,7 @@ import ( "bytes" "compress/gzip" "compress/zlib" - "elastic/apm-lambda-extension/apmproxy" + "github.com/elastic/apm-aws-lambda/apmproxy" "io" "testing" diff --git a/apmproxy/receiver_test.go b/apmproxy/receiver_test.go index f4e681ac..a66de72c 100644 --- a/apmproxy/receiver_test.go +++ b/apmproxy/receiver_test.go @@ -19,7 +19,7 @@ package apmproxy_test import ( "bytes" - "elastic/apm-lambda-extension/apmproxy" + "github.com/elastic/apm-aws-lambda/apmproxy" "io" "net" "net/http" diff --git a/app/app.go b/app/app.go index 1ffbe709..c7788390 100644 --- a/app/app.go +++ b/app/app.go @@ -18,10 +18,10 @@ package app import ( - "elastic/apm-lambda-extension/apmproxy" - "elastic/apm-lambda-extension/extension" - "elastic/apm-lambda-extension/logger" - "elastic/apm-lambda-extension/logsapi" + "github.com/elastic/apm-aws-lambda/apmproxy" + "github.com/elastic/apm-aws-lambda/extension" + "github.com/elastic/apm-aws-lambda/logger" + "github.com/elastic/apm-aws-lambda/logsapi" "fmt" "os" "strconv" diff --git a/app/run.go b/app/run.go index 85766f5c..3c35aa5e 100644 --- a/app/run.go +++ b/app/run.go @@ -19,9 +19,9 @@ package app import ( "context" - "elastic/apm-lambda-extension/apmproxy" - "elastic/apm-lambda-extension/extension" - "elastic/apm-lambda-extension/logsapi" + "github.com/elastic/apm-aws-lambda/apmproxy" + "github.com/elastic/apm-aws-lambda/extension" + "github.com/elastic/apm-aws-lambda/logsapi" "fmt" "sync" "time" diff --git a/e2e-testing/e2e_test.go b/e2e-testing/e2e_test.go index f8c86bd3..8481f15d 100644 --- a/e2e-testing/e2e_test.go +++ b/e2e-testing/e2e_test.go @@ -18,7 +18,7 @@ package e2eTesting import ( - "elastic/apm-lambda-extension/logger" + "github.com/elastic/apm-aws-lambda/logger" "flag" "fmt" "io" diff --git a/e2e-testing/e2e_util.go b/e2e-testing/e2e_util.go index b51de712..42bb63a6 100644 --- a/e2e-testing/e2e_util.go +++ b/e2e-testing/e2e_util.go @@ -29,7 +29,7 @@ import ( "path/filepath" "strings" - "elastic/apm-lambda-extension/apmproxy" + "github.com/elastic/apm-aws-lambda/apmproxy" "go.uber.org/zap" ) diff --git a/extension/process_env.go b/extension/process_env.go index 6d0e90c6..b747ce5c 100644 --- a/extension/process_env.go +++ b/extension/process_env.go @@ -19,7 +19,7 @@ package extension import ( "context" - "elastic/apm-lambda-extension/logger" + "github.com/elastic/apm-aws-lambda/logger" "encoding/base64" "fmt" "os" diff --git a/logger/logger_test.go b/logger/logger_test.go index c0215e5e..ae176b5a 100644 --- a/logger/logger_test.go +++ b/logger/logger_test.go @@ -18,7 +18,7 @@ package logger_test import ( - "elastic/apm-lambda-extension/logger" + "github.com/elastic/apm-aws-lambda/logger" "os" "testing" diff --git a/logsapi/client_test.go b/logsapi/client_test.go index cb75cf0c..d3878528 100644 --- a/logsapi/client_test.go +++ b/logsapi/client_test.go @@ -19,7 +19,7 @@ package logsapi_test import ( "bytes" - "elastic/apm-lambda-extension/logsapi" + "github.com/elastic/apm-aws-lambda/logsapi" "encoding/json" "net/http" "net/http/httptest" diff --git a/logsapi/event.go b/logsapi/event.go index 345b39f8..544633ae 100644 --- a/logsapi/event.go +++ b/logsapi/event.go @@ -19,8 +19,8 @@ package logsapi import ( "context" - "elastic/apm-lambda-extension/apmproxy" - "elastic/apm-lambda-extension/extension" + "github.com/elastic/apm-aws-lambda/extension" + "github.com/elastic/apm-aws-lambda/apmproxy" "time" ) diff --git a/logsapi/metrics.go b/logsapi/metrics.go index e5213c40..36e9e9c5 100644 --- a/logsapi/metrics.go +++ b/logsapi/metrics.go @@ -20,9 +20,8 @@ package logsapi import ( "math" - "elastic/apm-lambda-extension/apmproxy" - "elastic/apm-lambda-extension/extension" - + "github.com/elastic/apm-aws-lambda/apmproxy" + "github.com/elastic/apm-aws-lambda/extension" "go.elastic.co/apm/v2/model" "go.elastic.co/fastjson" ) diff --git a/logsapi/metrics_test.go b/logsapi/metrics_test.go index 23652848..05f8ba75 100644 --- a/logsapi/metrics_test.go +++ b/logsapi/metrics_test.go @@ -24,8 +24,8 @@ import ( "testing" "time" - "elastic/apm-lambda-extension/apmproxy" - "elastic/apm-lambda-extension/extension" + "github.com/elastic/apm-aws-lambda/apmproxy" + "github.com/elastic/apm-aws-lambda/extension" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/main.go b/main.go index c3e4921b..fbc7069b 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,7 @@ import ( "path/filepath" "syscall" - "elastic/apm-lambda-extension/app" + "github.com/elastic/apm-aws-lambda/app" ) func main() { diff --git a/main_test.go b/main_test.go index a7fe9341..1bf0b0dd 100644 --- a/main_test.go +++ b/main_test.go @@ -31,11 +31,11 @@ import ( "testing" "time" - "elastic/apm-lambda-extension/app" - e2eTesting "elastic/apm-lambda-extension/e2e-testing" - "elastic/apm-lambda-extension/extension" - "elastic/apm-lambda-extension/logger" - "elastic/apm-lambda-extension/logsapi" + "github.com/elastic/apm-aws-lambda/app" + e2eTesting "github.com/elastic/apm-aws-lambda/e2e-testing" + "github.com/elastic/apm-aws-lambda/extension" + "github.com/elastic/apm-aws-lambda/logger" + "github.com/elastic/apm-aws-lambda/logsapi" "github.com/google/uuid" "github.com/stretchr/testify/assert" From 72b7a15566d9def0c4268ed75b56b588156514ba Mon Sep 17 00:00:00 2001 From: kruskall <99559985+kruskall@users.noreply.github.com> Date: Tue, 23 Aug 2022 03:44:30 +0200 Subject: [PATCH 4/8] docs: remove duplicate information from the readme --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index 0328ad49..389aa693 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,6 @@ This repository contains code and tools for working with the Elastic APM AWS Lambda extension. -Elastic APM Agents can be used with AWS Lambda to monitor the execution of your AWS Lambda functions. -Currently the Node.js, Python and Java Agents are supported. - -The extension listens for data once per function invocation and forwards data to an APM Server. - ## Documentation Ready to use Elastic APM to monitor your Lambda functions? See [Monitoring AWS Lambda Functions](https://www.elastic.co/guide/en/apm/guide/current/monitoring-aws-lambda.html) to get started. From ca8d27132c1d5b84487f337923700578de7abf44 Mon Sep 17 00:00:00 2001 From: kruskall <99559985+kruskall@users.noreply.github.com> Date: Tue, 23 Aug 2022 03:49:48 +0200 Subject: [PATCH 5/8] docs: add testing.md --- TESTING.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 TESTING.md diff --git a/TESTING.md b/TESTING.md new file mode 100644 index 00000000..11f97caf --- /dev/null +++ b/TESTING.md @@ -0,0 +1,57 @@ +# APM AWS Lambda extension Testing + +## Testing unreleased versions +If you need to test an unreleased version you can compile the package and it's dependencies and make them available as AWS Lambda Layer. + +### Compile package and dependencies + +To run an unreleased version of this extension, you will need to ensure that your build architecture matches that of the Lambda execution environment by compiling with `GOOS=linux` and `GOARCH=amd64` if you are not running in a Linux environment. + +To build the extension into the `bin/extensions` folder, run the following commands. + +```bash +$ cd apm-lambda-extension +$ GOOS=linux GOARCH=amd64 go build -o bin/extensions/apm-lambda-extension main.go +$ chmod +x bin/extensions/apm-lambda-extension +``` + +### Layer Setup Process + +Once you've compiled the extension, the next step is to make it available as an AWS Lambda Layer. In order to do this we'll need to create a zip file with the extension binary, and then use the `lambda publish-layer-version` command/sub-command of the AWS CLI. + +The extensions .zip file should contain a root directory called `extensions/`, where the extension executables are located. In this sample project we must include the `apm-lambda-extension` binary. + +To create the zip file, run the following commands from the root of your project folder. + +```bash +$ cd apm-lambda-extension/bin +$ zip -r extension.zip extensions/ +``` + +To publish the zip file as a layer, run the following command using the AWS cli (presumes you have v2 of the aws-cli installed). + +Ensure that you have aws-cli v2 for the commands below. +Publish a new layer using the `extension.zip`. The output of the following command should provide you a layer arn. + +```bash +aws lambda publish-layer-version \ + --layer-name "apm-lambda-extension" \ + --region \ + --zip-file "fileb://extension.zip" +``` + +The out from the above command will include a `LayverVersionArn` field, which contains the unique string identifier for your layer. The will look something like the following. + + `"LayerVersionArn": "arn:aws:lambda::123456789012:layer::1"` + +This is the string you'll enter in the AWS Lambda Console to add this layer to your Lambda function. + +### One Step Build + +The `Makefile` also provides a `build-and-publish` command which will perform the above steps for use, using ENV variable for credentials and other information. + + $ ELASTIC_LAYER_NAME=apm-lambda-extension \ + AWS_DEFAULT_REGION=us-west-2 \ + AWS_ACCESS_KEY_ID=A...X \ + AWS_SECRET_ACCESS_KEY=h...E \ + make build-and-publish From 8657b84988ac15b0ef639a89041d2738eed34c82 Mon Sep 17 00:00:00 2001 From: kruskall <99559985+kruskall@users.noreply.github.com> Date: Tue, 23 Aug 2022 03:50:45 +0200 Subject: [PATCH 6/8] docs: keep the readme minimal --- README.md | 56 ------------------------------------------------------- 1 file changed, 56 deletions(-) diff --git a/README.md b/README.md index 389aa693..31b64e98 100644 --- a/README.md +++ b/README.md @@ -19,62 +19,6 @@ For any other assistance, please open or add to a topic on the [APM discuss foru See [contributing](CONTRIBUTING.md) for details about reporting bugs, requesting features, or code contributions. -## Testing unreleased versions -If you need to test an unreleased version you can compile the package and it's dependencies and make them available as AWS Lambda Layer. - -### Compile package and dependencies - -To run an unreleased version of this extension, you will need to ensure that your build architecture matches that of the Lambda execution environment by compiling with `GOOS=linux` and `GOARCH=amd64` if you are not running in a Linux environment. - -To build the extension into the `bin/extensions` folder, run the following commands. - -```bash -$ cd apm-lambda-extension -$ GOOS=linux GOARCH=amd64 go build -o bin/extensions/apm-lambda-extension main.go -$ chmod +x bin/extensions/apm-lambda-extension -``` - -### Layer Setup Process - -Once you've compiled the extension, the next step is to make it available as an AWS Lambda Layer. In order to do this we'll need to create a zip file with the extension binary, and then use the `lambda publish-layer-version` command/sub-command of the AWS CLI. - -The extensions .zip file should contain a root directory called `extensions/`, where the extension executables are located. In this sample project we must include the `apm-lambda-extension` binary. - -To create the zip file, run the following commands from the root of your project folder. - -```bash -$ cd apm-lambda-extension/bin -$ zip -r extension.zip extensions/ -``` - -To publish the zip file as a layer, run the following command using the AWS cli (presumes you have v2 of the aws-cli installed). - -Ensure that you have aws-cli v2 for the commands below. -Publish a new layer using the `extension.zip`. The output of the following command should provide you a layer arn. - -```bash -aws lambda publish-layer-version \ - --layer-name "apm-lambda-extension" \ - --region \ - --zip-file "fileb://extension.zip" -``` - -The out from the above command will include a `LayverVersionArn` field, which contains the unique string identifier for your layer. The will look something like the following. - - `"LayerVersionArn": "arn:aws:lambda::123456789012:layer::1"` - -This is the string you'll enter in the AWS Lambda Console to add this layer to your Lambda function. - -### One Step Build - -The `Makefile` also provides a `build-and-publish` command which will perform the above steps for use, using ENV variable for credentials and other information. - - $ ELASTIC_LAYER_NAME=apm-lambda-extension \ - AWS_DEFAULT_REGION=us-west-2 \ - AWS_ACCESS_KEY_ID=A...X \ - AWS_SECRET_ACCESS_KEY=h...E \ - make build-and-publish - ## Release Procedure See [release](RELEASE.md) for details. From 36ee0473f4aa5f460cc043f1f193d8b24f3184d3 Mon Sep 17 00:00:00 2001 From: kruskall <99559985+kruskall@users.noreply.github.com> Date: Tue, 23 Aug 2022 09:07:16 +0200 Subject: [PATCH 7/8] docs: fix typos Co-authored-by: Andrew Wilkins --- TESTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TESTING.md b/TESTING.md index 11f97caf..b2fbad1d 100644 --- a/TESTING.md +++ b/TESTING.md @@ -7,7 +7,7 @@ If you need to test an unreleased version you can compile the package and it's d To run an unreleased version of this extension, you will need to ensure that your build architecture matches that of the Lambda execution environment by compiling with `GOOS=linux` and `GOARCH=amd64` if you are not running in a Linux environment. -To build the extension into the `bin/extensions` folder, run the following commands. +To build the extension in the `bin/extensions` folder, run the following commands. ```bash $ cd apm-lambda-extension @@ -40,7 +40,7 @@ aws lambda publish-layer-version \ --zip-file "fileb://extension.zip" ``` -The out from the above command will include a `LayverVersionArn` field, which contains the unique string identifier for your layer. The will look something like the following. +The output from the above command will include a `LayerVersionArn` field, which contains the unique string identifier for your layer. The will look something like the following. `"LayerVersionArn": "arn:aws:lambda::123456789012:layer::1"` From cdcefe558f6b49d4694f8474dcfb93079e3f8615 Mon Sep 17 00:00:00 2001 From: kruskall <99559985+kruskall@users.noreply.github.com> Date: Tue, 23 Aug 2022 09:08:06 +0200 Subject: [PATCH 8/8] docs: fix another typo Co-authored-by: Andrew Wilkins --- TESTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TESTING.md b/TESTING.md index b2fbad1d..75b4ac2a 100644 --- a/TESTING.md +++ b/TESTING.md @@ -1,7 +1,7 @@ # APM AWS Lambda extension Testing ## Testing unreleased versions -If you need to test an unreleased version you can compile the package and it's dependencies and make them available as AWS Lambda Layer. +If you need to test an unreleased version you can compile the package and its dependencies and make them available as AWS Lambda Layer. ### Compile package and dependencies