From d10888b66e25e80f7de16812ae005a692d79828f Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Tue, 20 Feb 2024 16:59:20 -0800 Subject: [PATCH 01/71] Testrelease 1.3.1.1 --- solarwinds_apm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/version.py b/solarwinds_apm/version.py index 67bc602ab..787445909 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "1.3.0" +__version__ = "1.3.1.1" From 0bfc60a43737bceac6e5f3884f5a9b0b040c27dc Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Tue, 20 Feb 2024 17:00:22 -0800 Subject: [PATCH 02/71] Translate aws-lambda-ll to workflow --- .../action.yaml | 2 +- .../action.yaml | 2 +- .../build_publish_lambda_layer_aarch64.yaml | 5 ++ .../build_publish_lambda_layer_x86_64.yaml | 5 ++ Makefile | 49 +++++++++++++++++++ lambda/requirements-custom.txt | 7 +++ pyproject.toml | 8 +-- 7 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 lambda/requirements-custom.txt diff --git a/.github/actions/package_lambda_solarwinds_apm_aarch64/action.yaml b/.github/actions/package_lambda_solarwinds_apm_aarch64/action.yaml index 83a3f73c4..727c03e1f 100644 --- a/.github/actions/package_lambda_solarwinds_apm_aarch64/action.yaml +++ b/.github/actions/package_lambda_solarwinds_apm_aarch64/action.yaml @@ -13,6 +13,6 @@ runs: image: quay.io/pypa/manylinux_2_28_aarch64:latest entrypoint: 'make' args: - - 'aws-lambda' + - 'aws-lambda-custom' env: PLATFORM: aarch64 \ No newline at end of file diff --git a/.github/actions/package_lambda_solarwinds_apm_x86_64/action.yaml b/.github/actions/package_lambda_solarwinds_apm_x86_64/action.yaml index 73d1e911a..00d1ac7c9 100644 --- a/.github/actions/package_lambda_solarwinds_apm_x86_64/action.yaml +++ b/.github/actions/package_lambda_solarwinds_apm_x86_64/action.yaml @@ -13,6 +13,6 @@ runs: image: quay.io/pypa/manylinux_2_28_x86_64:latest entrypoint: 'make' args: - - 'aws-lambda' + - 'aws-lambda-custom' env: PLATFORM: x86_64 \ No newline at end of file diff --git a/.github/workflows/build_publish_lambda_layer_aarch64.yaml b/.github/workflows/build_publish_lambda_layer_aarch64.yaml index 56996df94..fdd12ed05 100644 --- a/.github/workflows/build_publish_lambda_layer_aarch64.yaml +++ b/.github/workflows/build_publish_lambda_layer_aarch64.yaml @@ -48,6 +48,11 @@ jobs: SW_APM_VERSION: ${{ steps.save-apm-python-version.outputs.SW_APM_VERSION }} steps: - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + repository: tammy-baylis-swi/opentelemetry-python-contrib + ref: build-lambda-handler-exceptions + path: contrib-custom - uses: ./.github/actions/package_lambda_solarwinds_apm_aarch64 - name: Save APM Python Version for naming id: save-apm-python-version diff --git a/.github/workflows/build_publish_lambda_layer_x86_64.yaml b/.github/workflows/build_publish_lambda_layer_x86_64.yaml index e43a728e4..c5dd39e3a 100644 --- a/.github/workflows/build_publish_lambda_layer_x86_64.yaml +++ b/.github/workflows/build_publish_lambda_layer_x86_64.yaml @@ -16,6 +16,11 @@ jobs: SW_APM_VERSION: ${{ steps.save-apm-python-version.outputs.SW_APM_VERSION }} steps: - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + repository: tammy-baylis-swi/opentelemetry-python-contrib + ref: build-lambda-handler-exceptions + path: contrib-custom - uses: ./.github/actions/package_lambda_solarwinds_apm_x86_64 - name: Save APM Python Version for naming id: save-apm-python-version diff --git a/Makefile b/Makefile index 032dad87a..db18ab161 100644 --- a/Makefile +++ b/Makefile @@ -226,6 +226,55 @@ aws-lambda: check-zip wrapper @rm -rf ${target_dir} ./build @echo -e "\nDone." +# Build APM Python AWS lambda layer as zip artifact +# with extension compatible with current environment +# (x86_64 OR aarch64) using custom AwsLambdaInstrumentor +target_dir := "./tmp-lambda" +aws-lambda-custom: export AWS_LAMBDA_FUNCTION_NAME = set-for-build +aws-lambda-custom: export LAMBDA_TASK_ROOT = set-for-build +aws-lambda-custom: check-zip wrapper + @if [ -f ./dist/solarwinds_apm_lambda_${platform}.zip ]; then \ + echo -e "Deleting old solarwinds_apm_lambda_${platform}.zip"; \ + rm ./dist/solarwinds_apm_lambda_${platform}.zip; \ + fi + rm -rf ${target_dir} + @echo -e "Creating target directory ${target_dir} for AWS Lambda layer artifacts." + mkdir -p ${target_dir}/python + @echo -e "Install upstream dependencies to include in layer" + @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/python -r lambda/requirements-custom.txt + @echo -e "Install upstream dependencies without deps to include in layer" + @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -r lambda/requirements-nodeps.txt --no-deps + @echo -e "Install aws-lambda instrumentor from local to include in layer" + @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -Ie ../contrib-custom/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-aws-lambda + @echo -e "Directly copying aws-lambda src files" + @mkdir ${target_dir}/nodeps/opentelemetry/instrumentation/aws_lambda + @cp -r ../contrib-custom/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/* ${target_dir}/nodeps/opentelemetry/instrumentation/aws_lambda + @echo -e "Install solarwinds_apm to be packed up in zip archive to target directory." + @/opt/python/cp38-cp38/bin/pip3.8 install . -t ${target_dir}/nodeps --no-deps + @echo -e "Removing non-lambda C-extension library files generated by pip install under target directory." + @rm -rf ${target_dir}/nodeps/solarwinds_apm/extension/*.so* + @echo -e "Building AWS Lambda version of C-extensions for all supported Python versions in target directory." + @set -e; for PYBIN in cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311; do /opt/python/$${PYBIN}/bin/python setup.py build_ext -b ${target_dir}/nodeps; done + @echo -e "Copying AWS Lambda specific Oboe library liboboe-1.0-lambda-${platform}.so into target directory." + @cp solarwinds_apm/extension/liboboe-1.0-lambda-${platform}.so ${target_dir}/nodeps/solarwinds_apm/extension/liboboe.so + @echo -e "Moving no-deps dependencies, needed for full opentelemetry/instrumentation path" + @cp -r ${target_dir}/nodeps/* ${target_dir}/python + @rm -rf ${target_dir}/nodeps + @echo -e "Copying OpenTelemetry lambda wrapper and entry script into target directory." + @cp lambda/otel_wrapper.py ${target_dir}/python/otel_wrapper.py + @cp lambda/otel-instrument ${target_dir}/otel-instrument + @chmod 755 ${target_dir}/otel-instrument + @echo -e "Removing unnecessary boto, six, setuptools, urllib3 installations" + @rm -rf ${target_dir}/python/boto* + @rm -rf ${target_dir}/python/six* + @rm -rf ${target_dir}/python/setuptools* + @rm -rf ${target_dir}/python/urllib3* + @find ${target_dir}/python -type d -name '__pycache__' | xargs rm -rf + @if [[ ! -d dist ]]; then mkdir dist; fi + @pushd ${target_dir} && zip -r ../dist/solarwinds_apm_lambda_${platform}.zip . && popd + @rm -rf ${target_dir} ./build + @echo -e "\nDone." + #----------------------------------------------------------------------------------------------------------------------# # recipes for local development #----------------------------------------------------------------------------------------------------------------------# diff --git a/lambda/requirements-custom.txt b/lambda/requirements-custom.txt new file mode 100644 index 000000000..f1b5fe612 --- /dev/null +++ b/lambda/requirements-custom.txt @@ -0,0 +1,7 @@ +opentelemetry-api==1.20.0 +opentelemetry-sdk==1.20.0 +opentelemetry-instrumentation==0.41b0 +opentelemetry-propagator-aws-xray==1.0.1 +opentelemetry-exporter-otlp==1.20.0 +opentelemetry-exporter-otlp-proto-grpc==1.20.0 +opentelemetry-exporter-otlp-proto-http==1.20.0 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index c60a356ea..8cf6b2944 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,10 +42,10 @@ classifiers = [ ] requires-python = ">=3.7" dependencies = [ - 'opentelemetry-api == 1.20.0', - 'opentelemetry-sdk == 1.20.0', - 'opentelemetry-instrumentation == 0.41b0', - 'opentelemetry-instrumentation-logging == 0.41b0', + # 'opentelemetry-api == 1.20.0', + # 'opentelemetry-sdk == 1.20.0', + # 'opentelemetry-instrumentation == 0.41b0', + # 'opentelemetry-instrumentation-logging == 0.41b0', ] [project.urls] From 0db9cf964a3f81b0701b3ad84654d68dedac3756 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Tue, 20 Feb 2024 17:05:39 -0800 Subject: [PATCH 03/71] Install path --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index db18ab161..c84345072 100644 --- a/Makefile +++ b/Makefile @@ -244,11 +244,13 @@ aws-lambda-custom: check-zip wrapper @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/python -r lambda/requirements-custom.txt @echo -e "Install upstream dependencies without deps to include in layer" @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -r lambda/requirements-nodeps.txt --no-deps + @echo "Contents of contrib-custom:" + @ls -al contrib-custom/ @echo -e "Install aws-lambda instrumentor from local to include in layer" - @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -Ie ../contrib-custom/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-aws-lambda + @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -Ie contrib-custom/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-aws-lambda @echo -e "Directly copying aws-lambda src files" @mkdir ${target_dir}/nodeps/opentelemetry/instrumentation/aws_lambda - @cp -r ../contrib-custom/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/* ${target_dir}/nodeps/opentelemetry/instrumentation/aws_lambda + @cp -r contrib-custom/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/* ${target_dir}/nodeps/opentelemetry/instrumentation/aws_lambda @echo -e "Install solarwinds_apm to be packed up in zip archive to target directory." @/opt/python/cp38-cp38/bin/pip3.8 install . -t ${target_dir}/nodeps --no-deps @echo -e "Removing non-lambda C-extension library files generated by pip install under target directory." From 3eca2806911d08aa313fa7fe4e6c05098327679b Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Tue, 20 Feb 2024 17:11:03 -0800 Subject: [PATCH 04/71] Path update again --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c84345072..ce0b9833d 100644 --- a/Makefile +++ b/Makefile @@ -247,10 +247,10 @@ aws-lambda-custom: check-zip wrapper @echo "Contents of contrib-custom:" @ls -al contrib-custom/ @echo -e "Install aws-lambda instrumentor from local to include in layer" - @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -Ie contrib-custom/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-aws-lambda + @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -Ie contrib-custom/instrumentation/opentelemetry-instrumentation-aws-lambda @echo -e "Directly copying aws-lambda src files" @mkdir ${target_dir}/nodeps/opentelemetry/instrumentation/aws_lambda - @cp -r contrib-custom/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/* ${target_dir}/nodeps/opentelemetry/instrumentation/aws_lambda + @cp -r contrib-custom/instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/* ${target_dir}/nodeps/opentelemetry/instrumentation/aws_lambda @echo -e "Install solarwinds_apm to be packed up in zip archive to target directory." @/opt/python/cp38-cp38/bin/pip3.8 install . -t ${target_dir}/nodeps --no-deps @echo -e "Removing non-lambda C-extension library files generated by pip install under target directory." From 71f968773cfce03888c001d9e35d782f210831e3 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 22 Feb 2024 11:50:06 -0800 Subject: [PATCH 05/71] Testrelease 1.3.1.2 --- solarwinds_apm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/version.py b/solarwinds_apm/version.py index 787445909..edeb9c06d 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "1.3.1.1" +__version__ = "1.3.1.2" From cee6012cbf68671702a172395bd2105bae82462f Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 22 Feb 2024 13:35:38 -0800 Subject: [PATCH 06/71] Update custom build script path --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4e965c80d..cac78e58a 100644 --- a/Makefile +++ b/Makefile @@ -265,8 +265,9 @@ aws-lambda-custom: check-zip wrapper @rm -rf ${target_dir}/nodeps @echo -e "Copying OpenTelemetry lambda wrapper and entry script into target directory." @cp lambda/otel_wrapper.py ${target_dir}/python/otel_wrapper.py - @cp lambda/otel-instrument ${target_dir}/otel-instrument - @chmod 755 ${target_dir}/otel-instrument + @mkdir ${target_dir}/solarwinds-apm/ + @cp lambda/solarwinds-apm/wrapper ${target_dir}/solarwinds-apm/wrapper + @chmod 755 ${target_dir}/solarwinds-apm/wrapper @echo -e "Removing unnecessary boto, six, setuptools, urllib3 installations" @rm -rf ${target_dir}/python/boto* @rm -rf ${target_dir}/python/six* From 64c4179eca18618c89b9f72e0c2e6456d3970e52 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 28 Feb 2024 15:24:04 -0800 Subject: [PATCH 07/71] Layer upgrade otel 1.23.0/0.44b0 --- dev-requirements.txt | 6 ++-- lambda/requirements-custom.txt | 12 +++---- lambda/requirements-nodeps.txt | 58 +++++++++++++++++----------------- lambda/requirements.txt | 8 ++--- pyproject.toml | 8 ++--- 5 files changed, 46 insertions(+), 46 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 345d21836..4b4fef0b5 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ -opentelemetry-test-utils==0.41b0 -opentelemetry-instrumentation-flask==0.41b0 -opentelemetry-instrumentation-requests==0.41b0 +opentelemetry-test-utils==0.44b0 +opentelemetry-instrumentation-flask==0.44b0 +opentelemetry-instrumentation-requests==0.44b0 pytest pytest-cov pytest-mock diff --git a/lambda/requirements-custom.txt b/lambda/requirements-custom.txt index f1b5fe612..3b14cc487 100644 --- a/lambda/requirements-custom.txt +++ b/lambda/requirements-custom.txt @@ -1,7 +1,7 @@ -opentelemetry-api==1.20.0 -opentelemetry-sdk==1.20.0 -opentelemetry-instrumentation==0.41b0 +opentelemetry-api==1.23.0 +opentelemetry-sdk==1.23.0 +opentelemetry-instrumentation==0.44b0 opentelemetry-propagator-aws-xray==1.0.1 -opentelemetry-exporter-otlp==1.20.0 -opentelemetry-exporter-otlp-proto-grpc==1.20.0 -opentelemetry-exporter-otlp-proto-http==1.20.0 \ No newline at end of file +opentelemetry-exporter-otlp==1.23.0 +opentelemetry-exporter-otlp-proto-grpc==1.23.0 +opentelemetry-exporter-otlp-proto-http==1.23.0 \ No newline at end of file diff --git a/lambda/requirements-nodeps.txt b/lambda/requirements-nodeps.txt index b51c1df2c..80ee69d65 100644 --- a/lambda/requirements-nodeps.txt +++ b/lambda/requirements-nodeps.txt @@ -1,30 +1,30 @@ -opentelemetry-instrumentation-aiohttp-client==0.41b0 -opentelemetry-util-http==0.41b0 +opentelemetry-instrumentation-aiohttp-client==0.44b0 +opentelemetry-util-http==0.44b0 asgiref~=3.7 -opentelemetry-instrumentation-asgi==0.41b0 -opentelemetry-instrumentation-asyncpg==0.41b0 -opentelemetry-instrumentation-boto==0.41b0 -opentelemetry-instrumentation-botocore==0.41b0 -opentelemetry-instrumentation-celery==0.41b0 -opentelemetry-instrumentation-dbapi==0.41b0 -opentelemetry-instrumentation-django==0.41b0 -opentelemetry-instrumentation-elasticsearch==0.41b0 -opentelemetry-instrumentation-fastapi==0.41b0 -opentelemetry-instrumentation-falcon==0.41b0 -opentelemetry-instrumentation-flask==0.41b0 -opentelemetry-instrumentation-grpc==0.41b0 -opentelemetry-instrumentation-jinja2==0.41b0 -opentelemetry-instrumentation-logging==0.41b0 -opentelemetry-instrumentation-mysql==0.41b0 -opentelemetry-instrumentation-psycopg2==0.41b0 -opentelemetry-instrumentation-pymemcache==0.41b0 -opentelemetry-instrumentation-pymongo==0.41b0 -opentelemetry-instrumentation-pymysql==0.41b0 -opentelemetry-instrumentation-pyramid==0.41b0 -opentelemetry-instrumentation-redis==0.41b0 -opentelemetry-instrumentation-requests==0.41b0 -opentelemetry-instrumentation-sqlalchemy==0.41b0 -opentelemetry-instrumentation-sqlite3==0.41b0 -opentelemetry-instrumentation-starlette==0.41b0 -opentelemetry-instrumentation-tornado==0.41b0 -opentelemetry-instrumentation-wsgi==0.41b0 \ No newline at end of file +opentelemetry-instrumentation-asgi==0.44b0 +opentelemetry-instrumentation-asyncpg==0.44b0 +opentelemetry-instrumentation-boto==0.44b0 +opentelemetry-instrumentation-botocore==0.44b0 +opentelemetry-instrumentation-celery==0.44b0 +opentelemetry-instrumentation-dbapi==0.44b0 +opentelemetry-instrumentation-django==0.44b0 +opentelemetry-instrumentation-elasticsearch==0.44b0 +opentelemetry-instrumentation-fastapi==0.44b0 +opentelemetry-instrumentation-falcon==0.44b0 +opentelemetry-instrumentation-flask==0.44b0 +opentelemetry-instrumentation-grpc==0.44b0 +opentelemetry-instrumentation-jinja2==0.44b0 +opentelemetry-instrumentation-logging==0.44b0 +opentelemetry-instrumentation-mysql==0.44b0 +opentelemetry-instrumentation-psycopg2==0.44b0 +opentelemetry-instrumentation-pymemcache==0.44b0 +opentelemetry-instrumentation-pymongo==0.44b0 +opentelemetry-instrumentation-pymysql==0.44b0 +opentelemetry-instrumentation-pyramid==0.44b0 +opentelemetry-instrumentation-redis==0.44b0 +opentelemetry-instrumentation-requests==0.44b0 +opentelemetry-instrumentation-sqlalchemy==0.44b0 +opentelemetry-instrumentation-sqlite3==0.44b0 +opentelemetry-instrumentation-starlette==0.44b0 +opentelemetry-instrumentation-tornado==0.44b0 +opentelemetry-instrumentation-wsgi==0.44b0 \ No newline at end of file diff --git a/lambda/requirements.txt b/lambda/requirements.txt index a437ebd20..63e312d63 100644 --- a/lambda/requirements.txt +++ b/lambda/requirements.txt @@ -1,4 +1,4 @@ -opentelemetry-exporter-otlp==1.20.0 -opentelemetry-exporter-otlp-proto-grpc==1.20.0 -opentelemetry-exporter-otlp-proto-http==1.20.0 -opentelemetry-instrumentation-aws-lambda==0.41b0 +opentelemetry-exporter-otlp==1.23.0 +opentelemetry-exporter-otlp-proto-grpc==1.23.0 +opentelemetry-exporter-otlp-proto-http==1.23.0 +opentelemetry-instrumentation-aws-lambda==0.44b0 diff --git a/pyproject.toml b/pyproject.toml index 8cf6b2944..4a7a14913 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,10 +42,10 @@ classifiers = [ ] requires-python = ">=3.7" dependencies = [ - # 'opentelemetry-api == 1.20.0', - # 'opentelemetry-sdk == 1.20.0', - # 'opentelemetry-instrumentation == 0.41b0', - # 'opentelemetry-instrumentation-logging == 0.41b0', + # 'opentelemetry-api == 1.23.0', + # 'opentelemetry-sdk == 1.23.0', + # 'opentelemetry-instrumentation == 0.44b0', + # 'opentelemetry-instrumentation-logging == 0.44b0', ] [project.urls] From 58ce1e4be6604f60a899d12bf785cb35fd2df978 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 28 Feb 2024 15:25:02 -0800 Subject: [PATCH 08/71] Testrelease 1.4.0.2 --- solarwinds_apm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/version.py b/solarwinds_apm/version.py index edeb9c06d..742626c4c 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "1.3.1.2" +__version__ = "1.4.0.2" From 3117f627828c9652df49bcba28207ecae3c5d98a Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Fri, 1 Mar 2024 10:08:48 -0800 Subject: [PATCH 09/71] Add requirements-so for layers --- Makefile | 4 ++++ lambda/requirements-so.txt | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 lambda/requirements-so.txt diff --git a/Makefile b/Makefile index cac78e58a..27f880b6d 100644 --- a/Makefile +++ b/Makefile @@ -243,6 +243,10 @@ aws-lambda-custom: check-zip wrapper mkdir -p ${target_dir}/python @echo -e "Install upstream dependencies to include in layer" @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/python -r lambda/requirements-custom.txt + @echo -e "Install other version-specific .so files for deps" + @set -e; for PYBIN in cp39-cp39 cp310-cp310 cp311-cp311; do /opt/python/$${PYBIN}/bin/pip install -t ${target_dir}/$${PYBIN} -r lambda/requirements-so.txt; done + @set -e; for PYBIN in cp39-cp39 cp310-cp310 cp311-cp311; do cp ${target_dir}/$${PYBIN}/charset_normalizer/*.so ${target_dir}/python/charset_normalizer/ && cp ${target_dir}/$${PYBIN}/grpc/_cython/*.so ${target_dir}/python/grpc/_cython/ && cp ${target_dir}/$${PYBIN}/wrapt/*.so ${target_dir}/python/wrapt/; done + @set -e; for PYBIN in cp39-cp39 cp310-cp310 cp311-cp311; do rm -rf ${target_dir}/$${PYBIN} ; done @echo -e "Install upstream dependencies without deps to include in layer" @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -r lambda/requirements-nodeps.txt --no-deps @echo "Contents of contrib-custom:" diff --git a/lambda/requirements-so.txt b/lambda/requirements-so.txt new file mode 100644 index 000000000..39b9e5db4 --- /dev/null +++ b/lambda/requirements-so.txt @@ -0,0 +1,3 @@ +charset_normalizer==3.3.2 +grpcio==1.62.0 +wrapt==1.16.0 \ No newline at end of file From 525c7d15cdcb4d63dae0254c615260aa558fc048 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Fri, 1 Mar 2024 10:09:19 -0800 Subject: [PATCH 10/71] Testrelease 1.4.0.3 --- solarwinds_apm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/version.py b/solarwinds_apm/version.py index 742626c4c..3e7478ea1 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "1.4.0.2" +__version__ = "1.4.0.3" From 89c4fbe83d6fbb3163cab7086847906e23149411 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 4 Mar 2024 09:56:50 -0800 Subject: [PATCH 11/71] Add volume for local build --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 4ea9ebcdb..310ee4605 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,6 +19,7 @@ services: volumes: - ./:/code/solarwinds_apm - ../solarwinds-apm-liboboe/:/code/solarwinds-apm-liboboe + - ../opentelemetry-python-contrib/:/code/solarwinds_apm/contrib-custom/ working_dir: /code/solarwinds_apm entrypoint: ["/bin/bash", "-c"] command: @@ -39,6 +40,7 @@ services: volumes: - ./:/code/solarwinds_apm - ../solarwinds-apm-liboboe/:/code/solarwinds-apm-liboboe + - ../opentelemetry-python-contrib/:/code/solarwinds_apm/contrib-custom/ working_dir: /code/solarwinds_apm entrypoint: ["/bin/bash", "-c"] command: From 977aafb67a932a8a88457890a39cc43ee6e1a821 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 4 Mar 2024 11:23:31 -0800 Subject: [PATCH 12/71] Testrelease 1.5.0.0 --- solarwinds_apm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/version.py b/solarwinds_apm/version.py index 3e8d9f946..dc914df24 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "1.4.0" +__version__ = "1.5.0.0" From 590687cc3233b244ecdcafcaf81175ac849254a1 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 4 Mar 2024 14:41:12 -0800 Subject: [PATCH 13/71] Update comment --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 27f880b6d..87847d261 100644 --- a/Makefile +++ b/Makefile @@ -229,7 +229,7 @@ aws-lambda: check-zip wrapper # Build APM Python AWS lambda layer as zip artifact # with extension compatible with current environment -# (x86_64 OR aarch64) using custom AwsLambdaInstrumentor +# (x86_64 OR aarch64) using custom contrib modules target_dir := "./tmp-lambda" aws-lambda-custom: export AWS_LAMBDA_FUNCTION_NAME = set-for-build aws-lambda-custom: export LAMBDA_TASK_ROOT = set-for-build From e0b55c0f5407a41b7e4d73cf1484713a0f5ae549 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Tue, 5 Mar 2024 09:47:20 -0800 Subject: [PATCH 14/71] load_instrumentor catches and logs --- solarwinds_apm/distro.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/solarwinds_apm/distro.py b/solarwinds_apm/distro.py index 4b51653f4..80e521def 100644 --- a/solarwinds_apm/distro.py +++ b/solarwinds_apm/distro.py @@ -116,7 +116,15 @@ def load_instrumentor(self, entry_point: EntryPoint, **kwargs): # Note: Django ORM accepts options in settings.py # https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/django/django.html kwargs["commenter_options"] = self.detect_commenter_options() - instrumentor: BaseInstrumentor = entry_point.load() + try: + instrumentor: BaseInstrumentor = entry_point.load() + except Exception as ex: # pylint: disable=broad-except + logger.error( + "Could not load instrumentor %s: %s", + entry_point.name, + ex, + ) + return instrumentor().instrument(**kwargs) def enable_commenter(self) -> bool: From bb66151aa44c1bd67cb984e0a89507c084e6951f Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 6 Mar 2024 17:21:49 -0800 Subject: [PATCH 15/71] Disable aws propagation by default --- lambda/solarwinds-apm/wrapper | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lambda/solarwinds-apm/wrapper b/lambda/solarwinds-apm/wrapper index 1c27295df..75876ca64 100644 --- a/lambda/solarwinds-apm/wrapper +++ b/lambda/solarwinds-apm/wrapper @@ -46,6 +46,9 @@ else export OTEL_RESOURCE_ATTRIBUTES="$LAMBDA_RESOURCE_ATTRIBUTES,$OTEL_RESOURCE_ATTRIBUTES"; fi +# Disable AWS context propagation by default +export OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION="true"; + # From OpenTelemetry Python: # - Use a wrapper because AWS Lambda's `python3 /var/runtime/bootstrap.py` will # use `imp.load_module` to load the function from the `_HANDLER` environment From d38f0c2673154c10b959588bae8e7b0252b78e8c Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 7 Mar 2024 17:02:23 -0800 Subject: [PATCH 16/71] Add make aws-lambda-orm --- .gitignore | 1 + Makefile | 22 ++++++++++++++++++++++ lambda/requirements-orm.txt | 2 ++ 3 files changed, 25 insertions(+) create mode 100644 lambda/requirements-orm.txt diff --git a/.gitignore b/.gitignore index 294f4e2ec..34e324db5 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ __pycache__/ build/ develop-eggs/ dist/ +dist_orm/ downloads/ eggs/ .eggs/ diff --git a/Makefile b/Makefile index 95074539c..9787fc8aa 100644 --- a/Makefile +++ b/Makefile @@ -287,6 +287,27 @@ aws-lambda-custom: check-zip wrapper @rm -rf ${target_dir} ./build @echo -e "\nDone." +# Build Python ORM AWS lambda layer as zip artifact +# with py38 extensions compatible with current environment +# (x86_64 OR aarch64) +target_dir := "./tmp-lambda-orm" +aws-lambda-orm: check-zip + @if [ -f ./dist/orm_lambda_${platform}.zip ]; then \ + echo -e "Deleting old orm_lambda_${platform}.zip"; \ + rm ./dist/orm_lambda_${platform}.zip; \ + fi + rm -rf ${target_dir} + @echo -e "Creating target directory ${target_dir} for AWS Lambda layer artifacts." + mkdir -p ${target_dir}/python + @echo -e "Install ORM modules to include in layer" + @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/python -r lambda/requirements-orm.txt + @find ${target_dir}/python -type d -name '__pycache__' | xargs rm -rf + @echo -e "Preparing ORM layer archive" + @if [[ ! -d dist_orm ]]; then mkdir dist_orm; fi + @pushd ${target_dir} && zip -r ../dist_orm/orm_lambda_${platform}.zip . && popd + @rm -rf ${target_dir} ./build + @echo -e "\nDone." + #----------------------------------------------------------------------------------------------------------------------# # recipes for local development #----------------------------------------------------------------------------------------------------------------------# @@ -364,6 +385,7 @@ clean: @find . -type d -name '*.ropeproject' | xargs rm -rf @rm -rf build/ @rm -rf dist/ + @rm -rf dist_orm/ @rm -rf *.egg* @rm -f MANIFEST @rm -rf docs/build/ diff --git a/lambda/requirements-orm.txt b/lambda/requirements-orm.txt new file mode 100644 index 000000000..69ecfd41c --- /dev/null +++ b/lambda/requirements-orm.txt @@ -0,0 +1,2 @@ +SQLAlchemy==2.0.28 +psycopg2_binary==2.9.9 \ No newline at end of file From 811f4176d1f90a554b3fc5071ffa7cdd1a62feb3 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Fri, 8 Mar 2024 10:56:21 -0800 Subject: [PATCH 17/71] Add packaging to reqs-nodeps --- lambda/requirements-nodeps.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lambda/requirements-nodeps.txt b/lambda/requirements-nodeps.txt index 80ee69d65..d87a14210 100644 --- a/lambda/requirements-nodeps.txt +++ b/lambda/requirements-nodeps.txt @@ -27,4 +27,5 @@ opentelemetry-instrumentation-sqlalchemy==0.44b0 opentelemetry-instrumentation-sqlite3==0.44b0 opentelemetry-instrumentation-starlette==0.44b0 opentelemetry-instrumentation-tornado==0.44b0 -opentelemetry-instrumentation-wsgi==0.44b0 \ No newline at end of file +opentelemetry-instrumentation-wsgi==0.44b0 +packaging>=21.0 From b483ddcbdbdaf733f53ade2e97dbe2f638fbc0e0 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 11 Mar 2024 16:06:11 -0700 Subject: [PATCH 18/71] Distro uses env for pass aws_context_propagation --- solarwinds_apm/distro.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/solarwinds_apm/distro.py b/solarwinds_apm/distro.py index 80e521def..306c67962 100644 --- a/solarwinds_apm/distro.py +++ b/solarwinds_apm/distro.py @@ -116,6 +116,13 @@ def load_instrumentor(self, entry_point: EntryPoint, **kwargs): # Note: Django ORM accepts options in settings.py # https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/django/django.html kwargs["commenter_options"] = self.detect_commenter_options() + + # Set disable for AwsLambdaInstrumentor. Assumes kwargs ignored + # if not implemented for current instrumentation library + kwargs["disable_aws_context_propagation"] = environ.get( + "OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION" + ) + try: instrumentor: BaseInstrumentor = entry_point.load() except Exception as ex: # pylint: disable=broad-except From 077c27171fc2af011baf6c055083ee11db278aa5 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 11 Mar 2024 16:18:39 -0700 Subject: [PATCH 19/71] Add debug line --- solarwinds_apm/distro.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/solarwinds_apm/distro.py b/solarwinds_apm/distro.py index 306c67962..9c007e2dc 100644 --- a/solarwinds_apm/distro.py +++ b/solarwinds_apm/distro.py @@ -132,6 +132,8 @@ def load_instrumentor(self, entry_point: EntryPoint, **kwargs): ex, ) return + + logger.debug("Instrumenting %s with kwargs %s", entry_point.name, kwargs) instrumentor().instrument(**kwargs) def enable_commenter(self) -> bool: From 5c930b81b071286eb7b91490f7ea9a4842018d98 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 11 Mar 2024 16:40:11 -0700 Subject: [PATCH 20/71] Add wrapper logging --- lambda/otel_wrapper.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lambda/otel_wrapper.py b/lambda/otel_wrapper.py index 295410406..d63e8892e 100644 --- a/lambda/otel_wrapper.py +++ b/lambda/otel_wrapper.py @@ -34,11 +34,14 @@ """ +import logging import os from importlib import import_module from opentelemetry.instrumentation.aws_lambda import AwsLambdaInstrumentor +logger = logging.getLogger() + def modify_module_name(module_name): """Returns a valid modified module to get imported""" @@ -49,6 +52,10 @@ class HandlerError(Exception): pass +logger.warning( + "Got OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION %s", + os.environ.get("OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION") +) AwsLambdaInstrumentor().instrument() path = os.environ.get("ORIG_HANDLER") From bae94929280be2ec5099a0ff58ccf94bfabfaa16 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 11 Mar 2024 16:50:46 -0700 Subject: [PATCH 21/71] wrapper checks existing disable_aws --- lambda/solarwinds-apm/wrapper | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lambda/solarwinds-apm/wrapper b/lambda/solarwinds-apm/wrapper index 75876ca64..a09b95641 100644 --- a/lambda/solarwinds-apm/wrapper +++ b/lambda/solarwinds-apm/wrapper @@ -47,7 +47,9 @@ else fi # Disable AWS context propagation by default -export OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION="true"; +if [ -z "${OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION}" ]; then + export OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION="true"; +fi # From OpenTelemetry Python: # - Use a wrapper because AWS Lambda's `python3 /var/runtime/bootstrap.py` will From 499065098cbce414e37075c89cf8f54a654ff0cf Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 11 Mar 2024 16:59:58 -0700 Subject: [PATCH 22/71] Revert "Add wrapper logging" This reverts commit 5c930b81b071286eb7b91490f7ea9a4842018d98. --- lambda/otel_wrapper.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lambda/otel_wrapper.py b/lambda/otel_wrapper.py index d63e8892e..295410406 100644 --- a/lambda/otel_wrapper.py +++ b/lambda/otel_wrapper.py @@ -34,14 +34,11 @@ """ -import logging import os from importlib import import_module from opentelemetry.instrumentation.aws_lambda import AwsLambdaInstrumentor -logger = logging.getLogger() - def modify_module_name(module_name): """Returns a valid modified module to get imported""" @@ -52,10 +49,6 @@ class HandlerError(Exception): pass -logger.warning( - "Got OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION %s", - os.environ.get("OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION") -) AwsLambdaInstrumentor().instrument() path = os.environ.get("ORIG_HANDLER") From f75dd2c74cf8de974db3a90dd5ca4ecbf970c9b0 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 11 Mar 2024 17:00:07 -0700 Subject: [PATCH 23/71] Revert "Add debug line" This reverts commit 077c27171fc2af011baf6c055083ee11db278aa5. --- solarwinds_apm/distro.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/solarwinds_apm/distro.py b/solarwinds_apm/distro.py index 9c007e2dc..306c67962 100644 --- a/solarwinds_apm/distro.py +++ b/solarwinds_apm/distro.py @@ -132,8 +132,6 @@ def load_instrumentor(self, entry_point: EntryPoint, **kwargs): ex, ) return - - logger.debug("Instrumenting %s with kwargs %s", entry_point.name, kwargs) instrumentor().instrument(**kwargs) def enable_commenter(self) -> bool: From 248c5f00a67675bf79a9f26b33867345f0b45b3b Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 11 Mar 2024 17:00:16 -0700 Subject: [PATCH 24/71] Revert "Distro uses env for pass aws_context_propagation" This reverts commit b483ddcbdbdaf733f53ade2e97dbe2f638fbc0e0. --- solarwinds_apm/distro.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/solarwinds_apm/distro.py b/solarwinds_apm/distro.py index 306c67962..80e521def 100644 --- a/solarwinds_apm/distro.py +++ b/solarwinds_apm/distro.py @@ -116,13 +116,6 @@ def load_instrumentor(self, entry_point: EntryPoint, **kwargs): # Note: Django ORM accepts options in settings.py # https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/django/django.html kwargs["commenter_options"] = self.detect_commenter_options() - - # Set disable for AwsLambdaInstrumentor. Assumes kwargs ignored - # if not implemented for current instrumentation library - kwargs["disable_aws_context_propagation"] = environ.get( - "OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION" - ) - try: instrumentor: BaseInstrumentor = entry_point.load() except Exception as ex: # pylint: disable=broad-except From 2537cdb9399aceee80b7fc3f950fe691d0600be4 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 14 Mar 2024 14:42:47 -0700 Subject: [PATCH 25/71] Revert "wrapper checks existing disable_aws" This reverts commit bae94929280be2ec5099a0ff58ccf94bfabfaa16. --- lambda/solarwinds-apm/wrapper | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lambda/solarwinds-apm/wrapper b/lambda/solarwinds-apm/wrapper index a09b95641..75876ca64 100644 --- a/lambda/solarwinds-apm/wrapper +++ b/lambda/solarwinds-apm/wrapper @@ -47,9 +47,7 @@ else fi # Disable AWS context propagation by default -if [ -z "${OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION}" ]; then - export OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION="true"; -fi +export OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION="true"; # From OpenTelemetry Python: # - Use a wrapper because AWS Lambda's `python3 /var/runtime/bootstrap.py` will From d04a840f42787078ceb04167e2a792fdd2059806 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 18 Mar 2024 11:45:56 -0700 Subject: [PATCH 26/71] Testrelease 1.6.0.0 --- solarwinds_apm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/version.py b/solarwinds_apm/version.py index 5b6018861..c38dddf52 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "1.5.0" +__version__ = "1.6.0.0" From 5a0c2a58e7fe0f9d3ef8198c2ee73aec2360997f Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 20 Mar 2024 10:07:49 -0700 Subject: [PATCH 27/71] Add distro detect_semconv_opt_in for instrumentor loading --- solarwinds_apm/distro.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/solarwinds_apm/distro.py b/solarwinds_apm/distro.py index 80e521def..eeeb02832 100644 --- a/solarwinds_apm/distro.py +++ b/solarwinds_apm/distro.py @@ -103,6 +103,11 @@ def load_instrumentor(self, entry_point: EntryPoint, **kwargs): on each one. This is a method override to pass additional arguments to each entry point. """ + # Set new semconv opt-in if configured + opt_in = self.detect_semconv_opt_in() + if opt_in: + kwargs["sem_conv_opt_in_mode"] = opt_in + # Set enable for sqlcommenter. Assumes kwargs ignored if not # implemented for current instrumentation library if self.enable_commenter(): @@ -157,3 +162,7 @@ def detect_commenter_options(self): commenter_opts[opt_k.strip()] = opt_v_bool return commenter_opts + + def detect_semconv_opt_in(self): + """Returns semconv opt-in config, if any""" + return environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") From 75d383d9c7267b8e4dcf884521fa50d69decddf0 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 20 Mar 2024 11:17:51 -0700 Subject: [PATCH 28/71] Custom packaging of opentelemetry-instrumentation --- Makefile | 4 ++++ lambda/requirements-custom.txt | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9787fc8aa..0d49fe7e0 100644 --- a/Makefile +++ b/Makefile @@ -255,6 +255,10 @@ aws-lambda-custom: check-zip wrapper @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -r lambda/requirements-nodeps.txt --no-deps @echo "Contents of contrib-custom:" @ls -al contrib-custom/ + @echo -e "Install opentelemetry-instrumentation from local to include in layer" + @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -Ie contrib-custom/opentelemetry-instrumentation + @echo -e "Directly copying opentelemetry-instrumentation src files" + @cp -r contrib-custom/opentelemetry-instrumentation/src/opentelemetry/instrumentation/* ${target_dir}/nodeps/opentelemetry/instrumentation @echo -e "Install aws-lambda instrumentor from local to include in layer" @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -Ie contrib-custom/instrumentation/opentelemetry-instrumentation-aws-lambda @echo -e "Directly copying aws-lambda src files" diff --git a/lambda/requirements-custom.txt b/lambda/requirements-custom.txt index 3b14cc487..4f18bf072 100644 --- a/lambda/requirements-custom.txt +++ b/lambda/requirements-custom.txt @@ -1,6 +1,5 @@ opentelemetry-api==1.23.0 opentelemetry-sdk==1.23.0 -opentelemetry-instrumentation==0.44b0 opentelemetry-propagator-aws-xray==1.0.1 opentelemetry-exporter-otlp==1.23.0 opentelemetry-exporter-otlp-proto-grpc==1.23.0 From 3a13aa467bfbcf7693fecc1b87676b096d538c54 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 20 Mar 2024 11:18:00 -0700 Subject: [PATCH 29/71] Testrelease 1.6.0.1 --- solarwinds_apm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/version.py b/solarwinds_apm/version.py index c38dddf52..d8cb04adb 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "1.6.0.0" +__version__ = "1.6.0.1" From 08ff4481b9578dedd6f82ff2a5a432087c8d4627 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 21 Mar 2024 12:52:10 -0700 Subject: [PATCH 30/71] Add publish-dest param for layer publish --- .../workflows/build_publish_lambda_layer.yaml | 15 ++++++++++++++- .../build_publish_lambda_layer_aarch64.yaml | 8 +++++++- .../build_publish_lambda_layer_x86_64.yaml | 8 +++++++- .github/workflows/publish_lambda_layer.yaml | 17 ++++++++++++++--- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_publish_lambda_layer.yaml b/.github/workflows/build_publish_lambda_layer.yaml index b311c9883..f16b32621 100644 --- a/.github/workflows/build_publish_lambda_layer.yaml +++ b/.github/workflows/build_publish_lambda_layer.yaml @@ -8,12 +8,25 @@ name: Publish APM Python lambda layer on: workflow_dispatch: - + inputs: + publish-dest: + required: true + description: 'Publish destination, one of: staging, production' + type: choice + default: 'staging' + options: + - staging + - production + jobs: build_publish_layer_x86_64: uses: ./.github/workflows/build_publish_lambda_layer_x86_64.yaml + with: + publish-dest: ${{ inputs.publish-dest }} secrets: inherit build_publish_layer_aarch64: uses: ./.github/workflows/build_publish_lambda_layer_aarch64.yaml + with: + publish-dest: ${{ inputs.publish-dest }} secrets: inherit diff --git a/.github/workflows/build_publish_lambda_layer_aarch64.yaml b/.github/workflows/build_publish_lambda_layer_aarch64.yaml index 9f4b54ebc..7eeadba60 100644 --- a/.github/workflows/build_publish_lambda_layer_aarch64.yaml +++ b/.github/workflows/build_publish_lambda_layer_aarch64.yaml @@ -4,10 +4,15 @@ # # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -name: Publish APM Python lambda layer for aarch64 +name: "Workflow call: Publish APM Python lambda layer for aarch64" on: workflow_call: + inputs: + publish-dest: + description: 'Publish destination, one of: staging, production' + required: true + type: string permissions: id-token: write @@ -100,4 +105,5 @@ jobs: component-version: ${{ needs.build_layer_aarch64.outputs.SW_APM_VERSION }} architecture: arm64 runtimes: "python3.8 python3.9 python3.10 python3.11" + publish-dest: ${{ inputs.publish-dest }} secrets: inherit \ No newline at end of file diff --git a/.github/workflows/build_publish_lambda_layer_x86_64.yaml b/.github/workflows/build_publish_lambda_layer_x86_64.yaml index c5dd39e3a..195c03ddc 100644 --- a/.github/workflows/build_publish_lambda_layer_x86_64.yaml +++ b/.github/workflows/build_publish_lambda_layer_x86_64.yaml @@ -4,10 +4,15 @@ # # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -name: Publish APM Python lambda layer for x86_64 +name: "Workflow call: Publish APM Python lambda layer for x86_64" on: workflow_call: + inputs: + publish-dest: + description: 'Publish destination, one of: staging, production' + required: true + type: string jobs: build_layer_x86_64: @@ -40,4 +45,5 @@ jobs: component-version: ${{ needs.build_layer_x86_64.outputs.SW_APM_VERSION }} architecture: x86_64 runtimes: "python3.7 python3.8 python3.9 python3.10 python3.11" + publish-dest: ${{ inputs.publish-dest }} secrets: inherit \ No newline at end of file diff --git a/.github/workflows/publish_lambda_layer.yaml b/.github/workflows/publish_lambda_layer.yaml index 04ad5dedd..1e4fda22d 100644 --- a/.github/workflows/publish_lambda_layer.yaml +++ b/.github/workflows/publish_lambda_layer.yaml @@ -4,7 +4,7 @@ # # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -name: Publish Lambda Layer to staging +name: "Workflow call: Publish Lambda Layer" on: workflow_call: @@ -25,6 +25,10 @@ on: description: 'Space-delimited list of compatible runtimes' required: true type: string + publish-dest: + description: 'Publish destination, one of: staging, production' + required: true + type: string permissions: id-token: write @@ -79,9 +83,16 @@ jobs: with: name: ${{ inputs.artifact-name }} - - uses: aws-actions/configure-aws-credentials@v4 + - if: ${{ inputs.publish-dest == 'staging' }} + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.LAMBDA_PUBLISHER_ARN_STAGING }} + aws-region: ${{ matrix.aws_region }} + + - if: ${{ inputs.publish-dest == 'production' }} + uses: aws-actions/configure-aws-credentials@v4 with: - role-to-assume: ${{ secrets.LAMBDA_PUBLISHER_ARN }} + role-to-assume: ${{ secrets.LAMBDA_PUBLISHER_ARN_PRODUCTION }} aws-region: ${{ matrix.aws_region }} - name: Publish Lambda Layer From c953748616fd2ec5f7be17b2384d42ff9bf2297b Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 21 Mar 2024 12:52:23 -0700 Subject: [PATCH 31/71] Testrelease 1.6.0.2 --- solarwinds_apm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/version.py b/solarwinds_apm/version.py index d8cb04adb..4dde418cd 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "1.6.0.1" +__version__ = "1.6.0.2" From ba7785ac15f11d34eafe9af78a2549970c6d3ff8 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 21 Mar 2024 13:05:44 -0700 Subject: [PATCH 32/71] Revert "Custom packaging of opentelemetry-instrumentation" This reverts commit 75d383d9c7267b8e4dcf884521fa50d69decddf0. --- Makefile | 4 ---- lambda/requirements-custom.txt | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0d49fe7e0..9787fc8aa 100644 --- a/Makefile +++ b/Makefile @@ -255,10 +255,6 @@ aws-lambda-custom: check-zip wrapper @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -r lambda/requirements-nodeps.txt --no-deps @echo "Contents of contrib-custom:" @ls -al contrib-custom/ - @echo -e "Install opentelemetry-instrumentation from local to include in layer" - @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -Ie contrib-custom/opentelemetry-instrumentation - @echo -e "Directly copying opentelemetry-instrumentation src files" - @cp -r contrib-custom/opentelemetry-instrumentation/src/opentelemetry/instrumentation/* ${target_dir}/nodeps/opentelemetry/instrumentation @echo -e "Install aws-lambda instrumentor from local to include in layer" @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -Ie contrib-custom/instrumentation/opentelemetry-instrumentation-aws-lambda @echo -e "Directly copying aws-lambda src files" diff --git a/lambda/requirements-custom.txt b/lambda/requirements-custom.txt index 4f18bf072..3b14cc487 100644 --- a/lambda/requirements-custom.txt +++ b/lambda/requirements-custom.txt @@ -1,5 +1,6 @@ opentelemetry-api==1.23.0 opentelemetry-sdk==1.23.0 +opentelemetry-instrumentation==0.44b0 opentelemetry-propagator-aws-xray==1.0.1 opentelemetry-exporter-otlp==1.23.0 opentelemetry-exporter-otlp-proto-grpc==1.23.0 From 6b72bc07ff4d2705d8a67535627fffd996b69e78 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 21 Mar 2024 13:05:51 -0700 Subject: [PATCH 33/71] Revert "Add distro detect_semconv_opt_in for instrumentor loading" This reverts commit 5a0c2a58e7fe0f9d3ef8198c2ee73aec2360997f. --- solarwinds_apm/distro.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/solarwinds_apm/distro.py b/solarwinds_apm/distro.py index eeeb02832..80e521def 100644 --- a/solarwinds_apm/distro.py +++ b/solarwinds_apm/distro.py @@ -103,11 +103,6 @@ def load_instrumentor(self, entry_point: EntryPoint, **kwargs): on each one. This is a method override to pass additional arguments to each entry point. """ - # Set new semconv opt-in if configured - opt_in = self.detect_semconv_opt_in() - if opt_in: - kwargs["sem_conv_opt_in_mode"] = opt_in - # Set enable for sqlcommenter. Assumes kwargs ignored if not # implemented for current instrumentation library if self.enable_commenter(): @@ -162,7 +157,3 @@ def detect_commenter_options(self): commenter_opts[opt_k.strip()] = opt_v_bool return commenter_opts - - def detect_semconv_opt_in(self): - """Returns semconv opt-in config, if any""" - return environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") From cf01b23f1eb87f02859a9b085661c7a0f989b255 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 21 Mar 2024 13:24:30 -0700 Subject: [PATCH 34/71] Typo --- .github/workflows/publish_lambda_layer.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_lambda_layer.yaml b/.github/workflows/publish_lambda_layer.yaml index 1e4fda22d..ab0d1926f 100644 --- a/.github/workflows/publish_lambda_layer.yaml +++ b/.github/workflows/publish_lambda_layer.yaml @@ -92,7 +92,7 @@ jobs: - if: ${{ inputs.publish-dest == 'production' }} uses: aws-actions/configure-aws-credentials@v4 with: - role-to-assume: ${{ secrets.LAMBDA_PUBLISHER_ARN_PRODUCTION }} + role-to-assume: ${{ secrets.LAMBDA_PUBLISHER_ARN_PROD }} aws-region: ${{ matrix.aws_region }} - name: Publish Lambda Layer From 196c41999f2ee5a953e108b7561a1c03a5b4cb76 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 25 Mar 2024 15:14:54 -0700 Subject: [PATCH 35/71] Drop Python3.7 support --- .../build_publish_lambda_layer_x86_64.yaml | 2 +- .github/workflows/verify_install.yaml | 29 ------------ CONTRIBUTING.md | 4 +- Makefile | 4 +- README.md | 2 +- pyproject.toml | 3 +- setup.py | 4 +- solarwinds_apm/apm_meter_manager.py | 3 +- solarwinds_apm/propagator.py | 2 +- solarwinds_apm/sampler.py | 2 +- .../trace/txnname_calculator_processor.py | 2 +- .../install/_helper_run_install_tests.sh | 4 +- tests/docker/install/docker-compose.yml | 46 ------------------- tests/docker/install/install_tests.sh | 5 +- 14 files changed, 18 insertions(+), 94 deletions(-) diff --git a/.github/workflows/build_publish_lambda_layer_x86_64.yaml b/.github/workflows/build_publish_lambda_layer_x86_64.yaml index 195c03ddc..0d3265ceb 100644 --- a/.github/workflows/build_publish_lambda_layer_x86_64.yaml +++ b/.github/workflows/build_publish_lambda_layer_x86_64.yaml @@ -44,6 +44,6 @@ jobs: artifact-name: solarwinds_apm_lambda_x86_64.zip component-version: ${{ needs.build_layer_x86_64.outputs.SW_APM_VERSION }} architecture: x86_64 - runtimes: "python3.7 python3.8 python3.9 python3.10 python3.11" + runtimes: "python3.8 python3.9 python3.10 python3.11" publish-dest: ${{ inputs.publish-dest }} secrets: inherit \ No newline at end of file diff --git a/.github/workflows/verify_install.yaml b/.github/workflows/verify_install.yaml index 2dd334900..f992a1a4e 100644 --- a/.github/workflows/verify_install.yaml +++ b/.github/workflows/verify_install.yaml @@ -56,11 +56,6 @@ jobs: matrix: | amazonlinux:2023 centos:8 - python:3.7-alpine3.12 - python:3.7-alpine3.13 - python:3.7-alpine3.17 - python:3.7-buster - python:3.7-bullseye python:3.8-alpine3.12 python:3.8-alpine3.13 python:3.8-buster @@ -100,12 +95,6 @@ jobs: strategy: matrix: hostname: - - py3.7-alpine3.12 - - py3.7-alpine3.13 - - py3.7-alpine3.17 - - py3.7-debian10 - - py3.7-debian11 - - py3.7-ubuntu18.04 - py3.8-alpine3.12 - py3.8-alpine3.13 - py3.8-debian10 @@ -139,18 +128,6 @@ jobs: - x64 - arm64 include: - - hostname: py3.7-alpine3.12 - image: python:3.7-alpine3.12 - - hostname: py3.7-alpine3.13 - image: python:3.7-alpine3.13 - - hostname: py3.7-alpine3.17 - image: python:3.7-alpine3.17 - - hostname: py3.7-debian10 - image: python:3.7-buster - - hostname: py3.7-debian11 - image: python:3.7-bullseye - - hostname: py3.7-ubuntu18.04 - image: ubuntu:18.04 - hostname: py3.8-alpine3.12 image: python:3.8-alpine3.12 - hostname: py3.8-alpine3.13 @@ -210,12 +187,6 @@ jobs: - hostname: py3.11-ubuntu22.04 image: ubuntu:22.04 exclude: - - hostname: py3.7-alpine3.12 - arch: arm64 - - hostname: py3.7-alpine3.13 - arch: arm64 - - hostname: py3.7-alpine3.17 - arch: arm64 - hostname: py3.8-alpine3.12 arch: arm64 - hostname: py3.8-alpine3.13 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c0371f6fb..7545efb6c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,11 +44,11 @@ docker-compose run aarch64 ### Regression Tests -Automated testing of this repo uses [tox](https://tox.readthedocs.io) and runs in Python 3.7, 3.8, 3.9, and/or 3.10 because these are the versions supported by [OTel Python](https://github.com/open-telemetry/opentelemetry-python/blob/main/tox.ini). Testing can be run inside a build container which provides all dependencies and a compiled C-extension. Here is how to set up then run unit and integration tests locally: +Automated testing of this repo uses [tox](https://tox.readthedocs.io) and runs in Python 3.8, 3.9, 3.10, and/or 3.11 because these are the versions supported by [OTel Python](https://github.com/open-telemetry/opentelemetry-python/blob/main/tox.ini). Testing can be run inside a build container which provides all dependencies and a compiled C-extension. Here is how to set up then run unit and integration tests locally: 1. Create and run a Docker build container as described above. 2. Inside the build container: `make wrapper`. This downloads the version of a C/C++ dependency defined in `extension/VERSION` from SolarWinds Cloud and builds SWIG bindings. -3. To run all tests for a specific version, provide tox options as a string. For example, to run in Python 3.7 against AO prod: `make tox OPTIONS="-e py37-nh-staging"`. +3. To run all tests for a specific version, provide tox options as a string. For example, to run in Python 3.9 against AO prod: `make tox OPTIONS="-e py39-nh-staging"`. 4. (WARNING: slow!) To run all tests for all supported Python environments, as well as linting and formatting: `make tox` Other regular `tox` arguments can be included in `OPTIONS`. Some examples: diff --git a/Makefile b/Makefile index 9787fc8aa..9c6ed462a 100644 --- a/Makefile +++ b/Makefile @@ -209,7 +209,7 @@ aws-lambda: check-zip wrapper @echo -e "Removing non-lambda C-extension library files generated by pip install under target directory." @rm -rf ${target_dir}/nodeps/solarwinds_apm/extension/*.so* @echo -e "Building AWS Lambda version of C-extensions for all supported Python versions in target directory." - @set -e; for PYBIN in cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311; do /opt/python/$${PYBIN}/bin/python setup.py build_ext -b ${target_dir}/nodeps; done + @set -e; for PYBIN in cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311; do /opt/python/$${PYBIN}/bin/python setup.py build_ext -b ${target_dir}/nodeps; done @echo -e "Copying AWS Lambda specific Oboe library liboboe-1.0-lambda-${platform}.so into target directory." @cp solarwinds_apm/extension/liboboe-1.0-lambda-${platform}.so ${target_dir}/nodeps/solarwinds_apm/extension/liboboe.so @echo -e "Moving no-deps dependencies, needed for full opentelemetry/instrumentation path" @@ -364,7 +364,7 @@ wrapper-from-local: check-swig copy-all # variable definitions and recipes for testing, linting, cleanup #----------------------------------------------------------------------------------------------------------------------# -# Example: make tox OPTIONS="-e py37-nh-staging" +# Example: make tox OPTIONS="-e py39-nh-staging" # Example: make tox OPTIONS="-e lint -- --check-only" tox: @python3.8 -m tox $(OPTIONS) diff --git a/README.md b/README.md index 051514c78..2e1985c97 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ An [OpenTelemetry Python](https://opentelemetry-python.readthedocs.io/) distribu ---- ## Requirements -All published artifacts support Python 3.7 or higher. A full list of system requirements is available at [SolarWinds Observability System Requirements](https://documentation.solarwinds.com/en/success_center/observability/default.htm#cshid=app-sysreqs-python-agent). +All published artifacts support Python 3.8 or higher. A full list of system requirements is available at [SolarWinds Observability System Requirements](https://documentation.solarwinds.com/en/success_center/observability/default.htm#cshid=app-sysreqs-python-agent). See [CONTRIBUTING.md](https://github.com/solarwinds/apm-python/blob/main/CONTRIBUTING.md) for how to build for development. diff --git a/pyproject.toml b/pyproject.toml index 4a7a14913..8e7d6bd9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,6 @@ keywords = [ "observability", ] classifiers = [ - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", @@ -40,7 +39,7 @@ classifiers = [ "Intended Audience :: Developers", "Intended Audience :: Information Technology", ] -requires-python = ">=3.7" +requires-python = ">=3.8" dependencies = [ # 'opentelemetry-api == 1.23.0', # 'opentelemetry-sdk == 1.23.0', diff --git a/setup.py b/setup.py index aea95a356..18fc1ffab 100644 --- a/setup.py +++ b/setup.py @@ -99,7 +99,7 @@ def run(self): if not (python_version_supported() and os_supported()): logger.warning( - "[SETUP] This package supports only Python 3.7 and above on Linux x86_64 or aarch64. " + "[SETUP] This package supports only Python 3.8 and above on Linux x86_64 or aarch64. " "Other platform or python versions may not work as expected.") ext_modules = [ @@ -132,5 +132,5 @@ def run(self): 'build_py': CustomBuild, }, ext_modules=ext_modules, - python_requires='>=3.7', + python_requires='>=3.8', ) diff --git a/solarwinds_apm/apm_meter_manager.py b/solarwinds_apm/apm_meter_manager.py index d9e9e5d99..c13f408cc 100644 --- a/solarwinds_apm/apm_meter_manager.py +++ b/solarwinds_apm/apm_meter_manager.py @@ -7,7 +7,8 @@ import logging # TypeError: 'ABCMeta' object is not subscriptable -# with this old import for callback signatures, with current Otel API +# with this old import for callback signatures, with current Otel API. +# So we keep this `typing` import until OTel is updated. # pylint:disable=deprecated-typing-alias from typing import TYPE_CHECKING, Iterable diff --git a/solarwinds_apm/propagator.py b/solarwinds_apm/propagator.py index 7d015f962..fa40337a4 100644 --- a/solarwinds_apm/propagator.py +++ b/solarwinds_apm/propagator.py @@ -154,7 +154,7 @@ def remove_custom_naming_baggage_header( return _format_baggage(baggage_kvs) # Note: this inherits deprecated `typing` use by OTel, - # I think for compatibility with Python3.7 else TypeError + # for compatibility with Python3.8 else TypeError @property def fields( self, diff --git a/solarwinds_apm/sampler.py b/solarwinds_apm/sampler.py index 4dbfa95b6..a970691ad 100644 --- a/solarwinds_apm/sampler.py +++ b/solarwinds_apm/sampler.py @@ -555,7 +555,7 @@ def calculate_attributes( return MappingProxyType(new_attributes) # Note: this inherits deprecated `typing` use by OTel, - # I think for compatibility with Python3.7 else TypeError + # for compatibility with Python3.8 else TypeError. def should_sample( self, parent_context: Optional[OtelContext], diff --git a/solarwinds_apm/trace/txnname_calculator_processor.py b/solarwinds_apm/trace/txnname_calculator_processor.py index edc7eaea5..488595527 100644 --- a/solarwinds_apm/trace/txnname_calculator_processor.py +++ b/solarwinds_apm/trace/txnname_calculator_processor.py @@ -66,7 +66,7 @@ def on_end(self, span: "ReadableSpan") -> None: custom_name, ) # type: ignore - # Disable pylint for compatibility with Python3.7 else TypeError + # Disable pylint for compatibility with Python 3.8 else TypeError def calculate_transaction_names( self, span: "ReadableSpan" ) -> Tuple[Any, Any]: # pylint: disable=deprecated-typing-alias diff --git a/tests/docker/install/_helper_run_install_tests.sh b/tests/docker/install/_helper_run_install_tests.sh index cba50532f..c92c3809c 100755 --- a/tests/docker/install/_helper_run_install_tests.sh +++ b/tests/docker/install/_helper_run_install_tests.sh @@ -18,9 +18,9 @@ # stop on error set -e -# get Python version from container hostname, e.g. "3.7", "3.10" +# get Python version from container hostname, e.g. "3.10" python_version=$(grep -Eo 'py3.[0-9]+[0-9]*' /etc/hostname | grep -Eo '3.[0-9]+[0-9]*') -# no-dot Python version, e.g. "36", "310" +# no-dot Python version, e.g. "310" python_version_no_dot=$(echo "$python_version" | sed 's/\.//') pretty_name=$(grep PRETTY_NAME /etc/os-release | sed 's/PRETTY_NAME="//' | sed 's/"//') diff --git a/tests/docker/install/docker-compose.yml b/tests/docker/install/docker-compose.yml index ce2ee790e..78ba31eca 100755 --- a/tests/docker/install/docker-compose.yml +++ b/tests/docker/install/docker-compose.yml @@ -41,52 +41,6 @@ services: # each service is a combination of python version and distro to test. #-------------------------------------------------------------------- - #-------------------------------------------------------------------- - # Python 3.7 - #-------------------------------------------------------------------- - - py3.7-install-debian10: - hostname: "py3.7-debian10" - image: "python:3.7-buster" - << : [*command-install-test, *workdir, *volumes-codebase] - environment: - << : *envvars-install-test - - py3.7-install-debian11: - hostname: "py3.7-debian11" - image: "python:3.7-bullseye" - << : [*command-install-test, *workdir, *volumes-codebase] - environment: - << : *envvars-install-test - - py3.7-install-ubuntu18.04: - hostname: "py3.7-ubuntu18.04" - image: "ubuntu:18.04" - << : [*command-install-test, *workdir, *volumes-codebase] - environment: - << : *envvars-install-test - - py3.7-install-alpine3.12: - hostname: "py3.7-alpine3.12" - image: "python:3.7-alpine3.12" - << : [*command-install-test, *workdir, *volumes-codebase] - environment: - << : *envvars-install-test - - py3.7-install-alpine3.13: - hostname: "py3.7-alpine3.13" - image: "python:3.7-alpine3.13" - << : [*command-install-test, *workdir, *volumes-codebase] - environment: - << : *envvars-install-test - - py3.7-install-alpine3.17: - hostname: "py3.7-alpine3.17" - image: "python:3.7-alpine3.17" - << : [*command-install-test, *workdir, *volumes-codebase] - environment: - << : *envvars-install-test - #-------------------------------------------------------------------- # Python 3.8 #-------------------------------------------------------------------- diff --git a/tests/docker/install/install_tests.sh b/tests/docker/install/install_tests.sh index b5f16bfed..a8e598521 100755 --- a/tests/docker/install/install_tests.sh +++ b/tests/docker/install/install_tests.sh @@ -55,10 +55,9 @@ function check_installation(){ found_swig_files_inst=$(find . -not -path '.' -a -not -name '*.pyc' -a -not -name '__pycache__' | LC_ALL=C sort) - # in Python3.7, 3.8, 3.9 with https://bugs.python.org/issue21536, C-extensions are not linked - # to libpython anymore, this leads to ldd not finding the symbols defined libpython3.(7|8|9).so + # in Python 3.8, 3.9 with https://bugs.python.org/issue21536, C-extensions are not linked + # to libpython anymore, this leads to ldd not finding the symbols defined libpython3.(8|9).so sad_pythons=( - 3.7 3.8 3.9 ) From 9d01763fb1dfa56c3ad0d97f6ff85287bb07bfe2 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 25 Mar 2024 15:27:27 -0700 Subject: [PATCH 36/71] Testrelease 1.6.0.3 --- solarwinds_apm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/version.py b/solarwinds_apm/version.py index 4dde418cd..af5e040b5 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "1.6.0.2" +__version__ = "1.6.0.3" From 7e19446cd28af30ad5e4065cdf52e0977173274d Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 25 Mar 2024 17:24:33 -0700 Subject: [PATCH 37/71] NH-76217 fix init event logging --- solarwinds_apm/configurator.py | 6 ++ .../test_configurator_configure.py | 59 +++++++++++++++++-- 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/solarwinds_apm/configurator.py b/solarwinds_apm/configurator.py index 79adc0d4d..ecfd8451f 100644 --- a/solarwinds_apm/configurator.py +++ b/solarwinds_apm/configurator.py @@ -91,6 +91,7 @@ def _configure(self, **kwargs: int) -> None: apm_config = SolarWindsApmConfig() oboe_api = apm_config.oboe_api + # Reporter may be no-op e.g. disabled, lambda reporter = self._initialize_solarwinds_reporter(apm_config) self._configure_otel_components( apm_txname_manager, @@ -99,6 +100,11 @@ def _configure(self, **kwargs: int) -> None: reporter, oboe_api, ) + + if apm_config.is_lambda: + logger.debug("No init event in lambda") + return + # Report reporter init status event after everything is done. init_event = self._create_init_event(reporter, apm_config) if init_event: diff --git a/tests/unit/test_configurator/test_configurator_configure.py b/tests/unit/test_configurator/test_configurator_configure.py index 51482d941..aaf6fc907 100644 --- a/tests/unit/test_configurator/test_configurator_configure.py +++ b/tests/unit/test_configurator/test_configurator_configure.py @@ -7,24 +7,63 @@ from solarwinds_apm import configurator class TestConfiguratorConfigure: - def test_configurator_configure_init_success( + def test_configurator_configure_init_lambda( self, mocker, mock_txn_name_manager_init, mock_fwkv_manager_init, - mock_apmconfig_enabled, mock_init_sw_reporter, mock_config_otel_components, mock_create_init, mock_report_init, ): + mock_apmconfig = mocker.Mock( + **{ + "is_lambda": True, + } + ) + apmconfig_init = mocker.patch( + "solarwinds_apm.configurator.SolarWindsApmConfig", + return_value=mock_apmconfig, + ) + test_configurator = configurator.SolarWindsConfigurator() test_configurator._configure() mock_txn_name_manager_init.assert_called_once() mock_fwkv_manager_init.assert_called_once() - mock_apmconfig_enabled.assert_called_once() + apmconfig_init.assert_called_once() + mock_init_sw_reporter.assert_called_once() + mock_config_otel_components.assert_called_once() + mock_create_init.assert_not_called() + mock_report_init.assert_not_called() + def test_configurator_configure_init_success( + self, + mocker, + mock_txn_name_manager_init, + mock_fwkv_manager_init, + mock_init_sw_reporter, + mock_config_otel_components, + mock_create_init, + mock_report_init, + ): + mock_apmconfig = mocker.Mock( + **{ + "is_lambda": False, + } + ) + apmconfig_init = mocker.patch( + "solarwinds_apm.configurator.SolarWindsApmConfig", + return_value=mock_apmconfig, + ) + + test_configurator = configurator.SolarWindsConfigurator() + test_configurator._configure() + + mock_txn_name_manager_init.assert_called_once() + mock_fwkv_manager_init.assert_called_once() + apmconfig_init.assert_called_once() mock_init_sw_reporter.assert_called_once() mock_config_otel_components.assert_called_once() mock_create_init.assert_called_once() @@ -35,12 +74,21 @@ def test_configurator_configure_init_failure( mocker, mock_txn_name_manager_init, mock_fwkv_manager_init, - mock_apmconfig_enabled, mock_init_sw_reporter, mock_config_otel_components, mock_create_init_fail, mock_report_init, ): + mock_apmconfig = mocker.Mock( + **{ + "is_lambda": False, + } + ) + apmconfig_init = mocker.patch( + "solarwinds_apm.configurator.SolarWindsApmConfig", + return_value=mock_apmconfig, + ) + mock_log_error = mocker.Mock() mock_logger = mocker.patch( "solarwinds_apm.configurator.logger" @@ -56,8 +104,7 @@ def test_configurator_configure_init_failure( mock_txn_name_manager_init.assert_called_once() mock_fwkv_manager_init.assert_called_once() - mock_apmconfig_enabled.assert_called_once() - + apmconfig_init.assert_called_once() mock_init_sw_reporter.assert_called_once() mock_config_otel_components.assert_called_once() mock_create_init_fail.assert_called_once() From 1750f122f4c10f19460b795e73ad94650db34072 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Tue, 26 Mar 2024 17:55:27 -0700 Subject: [PATCH 38/71] Add aws-lambda-custom check step --- Makefile | 21 ++++++---- lambda/check_lambda_modules.sh | 70 ++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 7 deletions(-) create mode 100755 lambda/check_lambda_modules.sh diff --git a/Makefile b/Makefile index 9c6ed462a..b9fa062f7 100644 --- a/Makefile +++ b/Makefile @@ -231,13 +231,8 @@ aws-lambda: check-zip wrapper @rm -rf ${target_dir} ./build @echo -e "\nDone." -# Build APM Python AWS lambda layer as zip artifact -# with extension compatible with current environment -# (x86_64 OR aarch64) using custom contrib modules target_dir := "./tmp-lambda" -aws-lambda-custom: export AWS_LAMBDA_FUNCTION_NAME = set-for-build -aws-lambda-custom: export LAMBDA_TASK_ROOT = set-for-build -aws-lambda-custom: check-zip wrapper +install-lambda-modules-custom: @if [ -f ./dist/solarwinds_apm_lambda_${platform}.zip ]; then \ echo -e "Deleting old solarwinds_apm_lambda_${platform}.zip"; \ rm ./dist/solarwinds_apm_lambda_${platform}.zip; \ @@ -281,6 +276,18 @@ aws-lambda-custom: check-zip wrapper @rm -rf ${target_dir}/python/six* @rm -rf ${target_dir}/python/setuptools* @rm -rf ${target_dir}/python/urllib3* + +check-lambda-modules-custom: + ./lambda/check_lambda_modules.sh ${target_dir} + +# Build APM Python AWS lambda layer as zip artifact +# with extension compatible with current environment +# (x86_64 OR aarch64) using custom contrib modules +target_dir := "./tmp-lambda" +aws-lambda-custom: export AWS_LAMBDA_FUNCTION_NAME = set-for-build +aws-lambda-custom: export LAMBDA_TASK_ROOT = set-for-build +aws-lambda-custom: check-zip wrapper install-lambda-modules-custom check-lambda-modules-custom +# aws-lambda-custom: check-lambda-modules-custom @find ${target_dir}/python -type d -name '__pycache__' | xargs rm -rf @if [[ ! -d dist ]]; then mkdir dist; fi @pushd ${target_dir} && zip -r ../dist/solarwinds_apm_lambda_${platform}.zip . && popd @@ -290,7 +297,7 @@ aws-lambda-custom: check-zip wrapper # Build Python ORM AWS lambda layer as zip artifact # with py38 extensions compatible with current environment # (x86_64 OR aarch64) -target_dir := "./tmp-lambda-orm" +target_dir := "./tmp-lambda" aws-lambda-orm: check-zip @if [ -f ./dist/orm_lambda_${platform}.zip ]; then \ echo -e "Deleting old orm_lambda_${platform}.zip"; \ diff --git a/lambda/check_lambda_modules.sh b/lambda/check_lambda_modules.sh new file mode 100755 index 000000000..1eca61089 --- /dev/null +++ b/lambda/check_lambda_modules.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +# © 2024 SolarWinds Worldwide, LLC. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +# stop on error +set -e + +pwd="$PWD" +base_dir="$1" +cd "$base_dir" +echo "Checking installed lambda files and modules" + +if [ ! -f "python/otel_wrapper.py" ]; then + echo "FAILED: Missing lambda otel_wrapper" + exit 1 +fi + +if [ ! -f "solarwinds-apm/wrapper" ]; then + echo "FAILED: Missing SolarWinds lambda wrapper" + exit 1 +fi + +expected_sw_extension_files="./python/solarwinds_apm/extension/VERSION +./python/solarwinds_apm/extension/__init__.py +./python/solarwinds_apm/extension/_oboe.*.so +./python/solarwinds_apm/extension/bson +./python/solarwinds_apm/extension/bson/bson.h +./python/solarwinds_apm/extension/bson/platform_hacks.h +./python/solarwinds_apm/extension/liboboe.so +./python/solarwinds_apm/extension/oboe.py" +found_sw_extension_files=$(find ./python/solarwinds_apm/extension -not -path ./python/solarwinds_apm/extension -a -not -name '*.pyc' -a -not -name '__pycache__' | LC_ALL=C sort) +if [[ ! "$found_sw_extension_files" =~ $expected_sw_extension_files ]]; then + echo "FAILED: Missing SolarWinds extension files" + exit 1 +fi + +expected_upstream_ext_files="./python/charset_normalizer/md.*.so +./python/charset_normalizer/md__mypyc.*.so +./python/grpc/_cython/cygrpc.*.so +./python/wrapt/_wrappers.*.so" +found_upstream_ext_files=$(find ./python/charset_normalizer ./python/grpc/_cython ./python/wrapt -regextype sed -regex ".*/*.so") +if [[ ! "$found_upstream_ext_files" =~ $expected_upstream_ext_files ]]; then + echo "FAILED: Missing upstream extension files" + exit 1 +fi + +if [ ! -f "python/opentelemetry/instrumentation/aws_lambda/__init__.py" ]; then + echo "FAILED: Missing AWS Lambda instrumentor" + exit 1 +fi + +expected_otel_files="./python/opentelemetry/exporter/otlp/version.py +./python/opentelemetry/exporter/otlp/proto/grpc/version.py +./python/opentelemetry/exporter/otlp/proto/common/version.py +./python/opentelemetry/exporter/otlp/proto/http/version.py +./python/opentelemetry/sdk/version.py +./python/opentelemetry/instrumentation/botocore/version.py" +found_otel_files=$(find ./python/opentelemetry/exporter ./python/opentelemetry/sdk ./python/opentelemetry/instrumentation/botocore -regextype sed -regex ".*/version.py") +if [[ ! "$found_otel_files" =~ $expected_otel_files ]]; then + echo "FAILED: Missing key opentelemetry dependency version files" + exit 1 +fi + +cd "$pwd" +echo "Successfully verified lambda files and modules for layer archive" +exit 0 From e342f03eed3ce13d9c5eabe12803f8ef19c081b7 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 27 Mar 2024 10:11:31 -0700 Subject: [PATCH 39/71] Rm comment --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index b9fa062f7..e83c22323 100644 --- a/Makefile +++ b/Makefile @@ -287,7 +287,6 @@ target_dir := "./tmp-lambda" aws-lambda-custom: export AWS_LAMBDA_FUNCTION_NAME = set-for-build aws-lambda-custom: export LAMBDA_TASK_ROOT = set-for-build aws-lambda-custom: check-zip wrapper install-lambda-modules-custom check-lambda-modules-custom -# aws-lambda-custom: check-lambda-modules-custom @find ${target_dir}/python -type d -name '__pycache__' | xargs rm -rf @if [[ ! -d dist ]]; then mkdir dist; fi @pushd ${target_dir} && zip -r ../dist/solarwinds_apm_lambda_${platform}.zip . && popd From 3a403a580503494530a15a7bb30d5129dee5ea3c Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 27 Mar 2024 10:12:02 -0700 Subject: [PATCH 40/71] Testrelease 1.6.0.4 --- solarwinds_apm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/version.py b/solarwinds_apm/version.py index af5e040b5..3bc39e619 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "1.6.0.3" +__version__ = "1.6.0.4" From a4e743c3a51758b6b369abbdc6f9e7bb810c1576 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 27 Mar 2024 10:16:48 -0700 Subject: [PATCH 41/71] Debug workflow --- .github/workflows/build_publish_lambda_layer.yaml | 10 +++++----- lambda/check_lambda_modules.sh | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_publish_lambda_layer.yaml b/.github/workflows/build_publish_lambda_layer.yaml index f16b32621..9b7887c52 100644 --- a/.github/workflows/build_publish_lambda_layer.yaml +++ b/.github/workflows/build_publish_lambda_layer.yaml @@ -25,8 +25,8 @@ jobs: publish-dest: ${{ inputs.publish-dest }} secrets: inherit - build_publish_layer_aarch64: - uses: ./.github/workflows/build_publish_lambda_layer_aarch64.yaml - with: - publish-dest: ${{ inputs.publish-dest }} - secrets: inherit + # build_publish_layer_aarch64: + # uses: ./.github/workflows/build_publish_lambda_layer_aarch64.yaml + # with: + # publish-dest: ${{ inputs.publish-dest }} + # secrets: inherit diff --git a/lambda/check_lambda_modules.sh b/lambda/check_lambda_modules.sh index 1eca61089..7ef63dd08 100755 --- a/lambda/check_lambda_modules.sh +++ b/lambda/check_lambda_modules.sh @@ -62,6 +62,8 @@ expected_otel_files="./python/opentelemetry/exporter/otlp/version.py found_otel_files=$(find ./python/opentelemetry/exporter ./python/opentelemetry/sdk ./python/opentelemetry/instrumentation/botocore -regextype sed -regex ".*/version.py") if [[ ! "$found_otel_files" =~ $expected_otel_files ]]; then echo "FAILED: Missing key opentelemetry dependency version files" + echo "Instead found:" + echo $found_otel_files exit 1 fi From 6bcd2a896849cc317ec0fc7ac14e76e0573eb935 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 27 Mar 2024 10:45:03 -0700 Subject: [PATCH 42/71] Add sort k1 to otel install check --- lambda/check_lambda_modules.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lambda/check_lambda_modules.sh b/lambda/check_lambda_modules.sh index 7ef63dd08..e4f3d0423 100755 --- a/lambda/check_lambda_modules.sh +++ b/lambda/check_lambda_modules.sh @@ -53,13 +53,13 @@ if [ ! -f "python/opentelemetry/instrumentation/aws_lambda/__init__.py" ]; then exit 1 fi -expected_otel_files="./python/opentelemetry/exporter/otlp/version.py +expected_otel_files="./python/opentelemetry/exporter/otlp/proto/common/version.py ./python/opentelemetry/exporter/otlp/proto/grpc/version.py -./python/opentelemetry/exporter/otlp/proto/common/version.py ./python/opentelemetry/exporter/otlp/proto/http/version.py -./python/opentelemetry/sdk/version.py -./python/opentelemetry/instrumentation/botocore/version.py" -found_otel_files=$(find ./python/opentelemetry/exporter ./python/opentelemetry/sdk ./python/opentelemetry/instrumentation/botocore -regextype sed -regex ".*/version.py") +./python/opentelemetry/exporter/otlp/version.py +./python/opentelemetry/instrumentation/botocore/version.py +./python/opentelemetry/sdk/version.py" +found_otel_files=$(find ./python/opentelemetry/exporter ./python/opentelemetry/sdk ./python/opentelemetry/instrumentation/botocore -regextype sed -regex ".*/version.py" | sort -k1) if [[ ! "$found_otel_files" =~ $expected_otel_files ]]; then echo "FAILED: Missing key opentelemetry dependency version files" echo "Instead found:" From bc207750b7d4fe21129e39a3f35edb8a46df50e9 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 27 Mar 2024 10:50:53 -0700 Subject: [PATCH 43/71] Revert "Debug workflow" This reverts commit a4e743c3a51758b6b369abbdc6f9e7bb810c1576. --- .github/workflows/build_publish_lambda_layer.yaml | 10 +++++----- lambda/check_lambda_modules.sh | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_publish_lambda_layer.yaml b/.github/workflows/build_publish_lambda_layer.yaml index 9b7887c52..f16b32621 100644 --- a/.github/workflows/build_publish_lambda_layer.yaml +++ b/.github/workflows/build_publish_lambda_layer.yaml @@ -25,8 +25,8 @@ jobs: publish-dest: ${{ inputs.publish-dest }} secrets: inherit - # build_publish_layer_aarch64: - # uses: ./.github/workflows/build_publish_lambda_layer_aarch64.yaml - # with: - # publish-dest: ${{ inputs.publish-dest }} - # secrets: inherit + build_publish_layer_aarch64: + uses: ./.github/workflows/build_publish_lambda_layer_aarch64.yaml + with: + publish-dest: ${{ inputs.publish-dest }} + secrets: inherit diff --git a/lambda/check_lambda_modules.sh b/lambda/check_lambda_modules.sh index e4f3d0423..e193e1c49 100755 --- a/lambda/check_lambda_modules.sh +++ b/lambda/check_lambda_modules.sh @@ -62,8 +62,6 @@ expected_otel_files="./python/opentelemetry/exporter/otlp/proto/common/version.p found_otel_files=$(find ./python/opentelemetry/exporter ./python/opentelemetry/sdk ./python/opentelemetry/instrumentation/botocore -regextype sed -regex ".*/version.py" | sort -k1) if [[ ! "$found_otel_files" =~ $expected_otel_files ]]; then echo "FAILED: Missing key opentelemetry dependency version files" - echo "Instead found:" - echo $found_otel_files exit 1 fi From 1fe4a7370062362956d795e9689f1213c75cb6e0 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 27 Mar 2024 16:57:21 -0700 Subject: [PATCH 44/71] tox drop py37, add py311 --- tox.ini | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tox.ini b/tox.ini index 3e3cf7c1e..6a79be391 100644 --- a/tox.ini +++ b/tox.ini @@ -2,8 +2,8 @@ skipsdist = True skip_missing_interpreters = True envlist = - py3{7,8,9,10}-ao-prod - py3{7,8,9,10}-nh-staging + py3{8,9,10,11}-ao-prod + py3{8,9,10,11}-nh-staging lint [testenv] @@ -14,17 +14,17 @@ allowlist_externals = echo deps = -rdev-requirements.txt commands_pre = - py3{7,8,9,10}: pip install --upgrade pip - py3{7,8,9,10}: pip install -Ie {toxinidir} + py3{8,9,10,11}: pip install --upgrade pip + py3{8,9,10,11}: pip install -Ie {toxinidir} commands = pytest {posargs} -[testenv:py3{7,8,9,10}-ao-prod] +[testenv:py3{8,9,10,11}-ao-prod] changedir = tests setenv = SW_APM_COLLECTOR = collector.appoptics.com SW_APM_SERVICE_KEY = foo-bar:service-key -[testenv:py3{7,8,9,10}-nh-staging] +[testenv:py3{8,9,10,11}-nh-staging] changedir = tests setenv = SW_APM_COLLECTOR = apm.collector.st-ssp.solarwinds.com From 4d09692f244e7bf32fb6e65e6bca238dfa6ad397 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 28 Mar 2024 11:15:20 -0700 Subject: [PATCH 45/71] Fix lambda check order --- Makefile | 2 +- lambda/check_lambda_modules.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e83c22323..b47718e3e 100644 --- a/Makefile +++ b/Makefile @@ -276,6 +276,7 @@ install-lambda-modules-custom: @rm -rf ${target_dir}/python/six* @rm -rf ${target_dir}/python/setuptools* @rm -rf ${target_dir}/python/urllib3* + @find ${target_dir}/python -type d -name '__pycache__' | xargs rm -rf check-lambda-modules-custom: ./lambda/check_lambda_modules.sh ${target_dir} @@ -287,7 +288,6 @@ target_dir := "./tmp-lambda" aws-lambda-custom: export AWS_LAMBDA_FUNCTION_NAME = set-for-build aws-lambda-custom: export LAMBDA_TASK_ROOT = set-for-build aws-lambda-custom: check-zip wrapper install-lambda-modules-custom check-lambda-modules-custom - @find ${target_dir}/python -type d -name '__pycache__' | xargs rm -rf @if [[ ! -d dist ]]; then mkdir dist; fi @pushd ${target_dir} && zip -r ../dist/solarwinds_apm_lambda_${platform}.zip . && popd @rm -rf ${target_dir} ./build diff --git a/lambda/check_lambda_modules.sh b/lambda/check_lambda_modules.sh index e193e1c49..532f23bb1 100755 --- a/lambda/check_lambda_modules.sh +++ b/lambda/check_lambda_modules.sh @@ -32,7 +32,7 @@ expected_sw_extension_files="./python/solarwinds_apm/extension/VERSION ./python/solarwinds_apm/extension/bson/platform_hacks.h ./python/solarwinds_apm/extension/liboboe.so ./python/solarwinds_apm/extension/oboe.py" -found_sw_extension_files=$(find ./python/solarwinds_apm/extension -not -path ./python/solarwinds_apm/extension -a -not -name '*.pyc' -a -not -name '__pycache__' | LC_ALL=C sort) +found_sw_extension_files=$(find ./python/solarwinds_apm/extension -not -path ./python/solarwinds_apm/extension | LC_ALL=C sort) if [[ ! "$found_sw_extension_files" =~ $expected_sw_extension_files ]]; then echo "FAILED: Missing SolarWinds extension files" exit 1 From dff6bb41aadc36566167b5674c94419963ce9740 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 28 Mar 2024 14:00:36 -0700 Subject: [PATCH 46/71] WIP add lambda wrapper test --- docker-compose.yml | 6 + lambda/solarwinds-apm/wrapper | 0 lambda/tests/mocks/lambda_function.py | 17 ++ lambda/tests/requirements.txt | 3 + lambda/tests/test_instrumentation.py | 269 ++++++++++++++++++++++++++ tox.ini | 6 + 6 files changed, 301 insertions(+) mode change 100644 => 100755 lambda/solarwinds-apm/wrapper create mode 100644 lambda/tests/mocks/lambda_function.py create mode 100644 lambda/tests/requirements.txt create mode 100644 lambda/tests/test_instrumentation.py diff --git a/docker-compose.yml b/docker-compose.yml index 310ee4605..bd2c4e5cb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,6 +11,7 @@ version: '2.4' services: x86_64: image: quay.io/pypa/manylinux_2_28_x86_64 + user: root stdin_open: true tty: true network_mode: host @@ -28,10 +29,13 @@ services: # twine to upload to TestPyPi # tox for automated tests python3.8 -m pip install boto3 twine tox + # update wrapper permissions for local testing in docker + chmod 755 /code/solarwinds_apm/lambda/solarwinds-apm/wrapper /bin/bash aarch64: image: quay.io/pypa/manylinux_2_28_aarch64 + user: root stdin_open: true tty: true network_mode: host @@ -49,4 +53,6 @@ services: # twine to upload to TestPyPi # tox for automated tests python3.8 -m pip install boto3 twine tox + # update wrapper permissions for local testing in docker + chmod 755 /code/solarwinds_apm/lambda/solarwinds-apm/wrapper /bin/bash diff --git a/lambda/solarwinds-apm/wrapper b/lambda/solarwinds-apm/wrapper old mode 100644 new mode 100755 diff --git a/lambda/tests/mocks/lambda_function.py b/lambda/tests/mocks/lambda_function.py new file mode 100644 index 000000000..577d20faf --- /dev/null +++ b/lambda/tests/mocks/lambda_function.py @@ -0,0 +1,17 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +def handler(event, context): + return "200 ok" \ No newline at end of file diff --git a/lambda/tests/requirements.txt b/lambda/tests/requirements.txt new file mode 100644 index 000000000..16530d9b7 --- /dev/null +++ b/lambda/tests/requirements.txt @@ -0,0 +1,3 @@ +# Dependencies used in tests only +opentelemetry-test-utils==0.44b0 +opentelemetry-instrumentation-aws-lambda==0.44b0 \ No newline at end of file diff --git a/lambda/tests/test_instrumentation.py b/lambda/tests/test_instrumentation.py new file mode 100644 index 000000000..03f802cb7 --- /dev/null +++ b/lambda/tests/test_instrumentation.py @@ -0,0 +1,269 @@ +# © 2024 SolarWinds Worldwide, LLC. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +""" +Tests that solarwinds-apm/wrapper successfully instruments a mock Lambda +environment with AwsLambdaInstrumentor and OTel Python-based APM distro. +""" + +import fileinput +import os +import subprocess +import sys +from importlib import import_module +from shutil import which +from unittest import mock + +from opentelemetry.environment_variables import OTEL_PROPAGATORS +from opentelemetry.instrumentation.aws_lambda import ( + _HANDLER, + _X_AMZN_TRACE_ID, + ORIG_HANDLER, + AwsLambdaInstrumentor, +) +from opentelemetry.propagators.aws.aws_xray_propagator import ( + TRACE_ID_FIRST_PART_LENGTH, + TRACE_ID_VERSION, +) +from opentelemetry.semconv.resource import ResourceAttributes +from opentelemetry.semconv.trace import SpanAttributes +from opentelemetry.test.test_base import TestBase +from opentelemetry.trace import SpanKind +from opentelemetry.trace.propagation.tracecontext import ( + TraceContextTextMapPropagator, +) + + +AWS_LAMBDA_EXEC_WRAPPER = "AWS_LAMBDA_EXEC_WRAPPER" +INIT_OTEL_SCRIPTS_DIR = os.path.join( + *(os.path.dirname(__file__), "..") +) +TOX_PYTHON_DIRECTORY = os.path.dirname(os.path.dirname(which("python3"))) + + +class MockLambdaContext: + def __init__(self, aws_request_id, invoked_function_arn): + self.invoked_function_arn = invoked_function_arn + self.aws_request_id = aws_request_id + + +MOCK_LAMBDA_CONTEXT = MockLambdaContext( + aws_request_id="mock_aws_request_id", + invoked_function_arn="arn:aws:lambda:us-east-1:123456:function:myfunction:myalias", +) + +MOCK_XRAY_TRACE_ID = 0x5FB7331105E8BB83207FA31D4D9CDB4C +MOCK_XRAY_TRACE_ID_STR = f"{MOCK_XRAY_TRACE_ID:x}" +MOCK_XRAY_PARENT_SPAN_ID = 0x3328B8445A6DBAD2 +MOCK_XRAY_TRACE_CONTEXT_COMMON = f"Root={TRACE_ID_VERSION}-{MOCK_XRAY_TRACE_ID_STR[:TRACE_ID_FIRST_PART_LENGTH]}-{MOCK_XRAY_TRACE_ID_STR[TRACE_ID_FIRST_PART_LENGTH:]};Parent={MOCK_XRAY_PARENT_SPAN_ID:x}" +MOCK_XRAY_TRACE_CONTEXT_SAMPLED = f"{MOCK_XRAY_TRACE_CONTEXT_COMMON};Sampled=1" +MOCK_XRAY_TRACE_CONTEXT_NOT_SAMPLED = ( + f"{MOCK_XRAY_TRACE_CONTEXT_COMMON};Sampled=0" +) + +MOCK_W3C_TRACE_ID = 0x5CE0E9A56015FEC5AADFA328AE398115 +MOCK_W3C_PARENT_SPAN_ID = 0xAB54A98CEB1F0AD2 +MOCK_W3C_TRACE_CONTEXT_SAMPLED = ( + f"00-{MOCK_W3C_TRACE_ID:x}-{MOCK_W3C_PARENT_SPAN_ID:x}-01" +) + +MOCK_W3C_TRACE_STATE_KEY = "vendor_specific_key" +MOCK_W3C_TRACE_STATE_VALUE = "test_value" + +def replace_in_file(filename, old_text, new_text): + with fileinput.FileInput(filename, inplace=True) as file_object: + for line in file_object: + # This directs the output to the file, not the console + print(line.replace(old_text, new_text), end="") + + +def mock_aws_lambda_exec_wrapper(): + """Mocks automatically instrumenting user Lambda function by pointing + `AWS_LAMBDA_EXEC_WRAPPER` to the `solarwinds-apm/wrapper` script. + """ + # NOTE: Like opentelemetry-lambda, this tests completion of auto + # instrumentation without error and if correct environment variables are set. + + print_environ_program = ( + "import os;" + f"print(f\"{ORIG_HANDLER}={{os.environ['{ORIG_HANDLER}']}}\");" + f"print(f\"{_HANDLER}={{os.environ['{_HANDLER}']}}\");" + ) + + completed_subprocess = subprocess.run( + [ + os.path.join(INIT_OTEL_SCRIPTS_DIR, "solarwinds-apm/wrapper"), + "python3", + "-c", + print_environ_program, + ], + check=True, + stdout=subprocess.PIPE, + text=True, + ) + + # NOTE: Like opentelemetry-lambda, `solarwinds-apm/wrapper` cannot affect + # this python environment. We parse the stdout produced by our test python + # program to update the environment in this parent python process. + + for env_var_line in completed_subprocess.stdout.split("\n"): + if env_var_line: + env_key, env_value = env_var_line.split("=") + os.environ[env_key] = env_value + + +def mock_execute_lambda(event=None): + """Mocks the AWS Lambda execution. Mocks importing and then calling the + method at the current `_HANDLER` environment variable. Like the real Lambda, + if `AWS_LAMBDA_EXEC_WRAPPER` is defined, it executes that before `_HANDLER`. + + NOTE: We don't use `moto`'s `mock_lambda` because we are not instrumenting + calls to AWS Lambda using the AWS SDK. Instead, we are instrumenting AWS + Lambda itself. + + See more: + https://docs.aws.amazon.com/lambda/latest/dg/runtimes-modify.html#runtime-wrapper + + Args: + event: The Lambda event which may or may not be used by instrumentation. + """ + globals()[os.environ[AWS_LAMBDA_EXEC_WRAPPER]]() + + module_name, handler_name = os.environ[_HANDLER].rsplit(".", 1) + handler_module = import_module(module_name.replace("/", ".")) + getattr(handler_module, handler_name)(event, MOCK_LAMBDA_CONTEXT) + + +class TestAwsLambdaInstrumentor(TestBase): + """AWS Lambda Instrumentation Testsuite""" + + @classmethod + def setUpClass(cls): + super().setUpClass() + sys.path.append(INIT_OTEL_SCRIPTS_DIR) + replace_in_file( + os.path.join(INIT_OTEL_SCRIPTS_DIR, "solarwinds-apm/wrapper"), + 'export LAMBDA_LAYER_PKGS_DIR="/opt/python"', + f'export LAMBDA_LAYER_PKGS_DIR="{TOX_PYTHON_DIRECTORY}"', + ) + + def setUp(self): + super().setUp() + self.common_env_patch = mock.patch.dict( + "os.environ", + { + AWS_LAMBDA_EXEC_WRAPPER: "mock_aws_lambda_exec_wrapper", + _HANDLER: "mocks.lambda_function.handler", + }, + ) + self.common_env_patch.start() + + def tearDown(self): + super().tearDown() + self.common_env_patch.stop() + AwsLambdaInstrumentor().uninstrument() + + @classmethod + def tearDownClass(cls): + super().tearDownClass() + sys.path.remove(INIT_OTEL_SCRIPTS_DIR) + replace_in_file( + os.path.join(INIT_OTEL_SCRIPTS_DIR, "solarwinds-apm/wrapper"), + f'export LAMBDA_LAYER_PKGS_DIR="{TOX_PYTHON_DIRECTORY}"', + 'export LAMBDA_LAYER_PKGS_DIR="/opt/python"', + ) + + def test_active_tracing(self): + test_env_patch = mock.patch.dict( + "os.environ", + { + **os.environ, + # Using Active tracing + _X_AMZN_TRACE_ID: MOCK_XRAY_TRACE_CONTEXT_SAMPLED, + }, + ) + test_env_patch.start() + + AwsLambdaInstrumentor().instrument() + + mock_execute_lambda() + + spans = self.memory_exporter.get_finished_spans() + + assert spans + + self.assertEqual(len(spans), 1) + span = spans[0] + self.assertEqual(span.name, os.environ[ORIG_HANDLER]) + self.assertEqual(span.get_span_context().trace_id, MOCK_XRAY_TRACE_ID) + self.assertEqual(span.kind, SpanKind.SERVER) + + # TODO: Failing because using PyPI's AwsLambdaInstrumentor + # self.assertSpanHasAttributes( + # span, + # { + # ResourceAttributes.FAAS_ID: MOCK_LAMBDA_CONTEXT.invoked_function_arn, + # SpanAttributes.FAAS_EXECUTION: MOCK_LAMBDA_CONTEXT.aws_request_id, + # ResourceAttributes.CLOUD_ACCOUNT_ID: MOCK_LAMBDA_CONTEXT.invoked_function_arn.split( + # ":" + # )[ + # 4 + # ], + # }, + # ) + + parent_context = span.parent + self.assertEqual( + parent_context.trace_id, span.get_span_context().trace_id + ) + self.assertEqual(parent_context.span_id, MOCK_XRAY_PARENT_SPAN_ID) + self.assertTrue(parent_context.is_remote) + + test_env_patch.stop() + + def test_parent_context_from_lambda_event(self): + test_env_patch = mock.patch.dict( + "os.environ", + { + **os.environ, + # NOT Active Tracing + _X_AMZN_TRACE_ID: MOCK_XRAY_TRACE_CONTEXT_NOT_SAMPLED, + # NOT using the X-Ray Propagator + OTEL_PROPAGATORS: "tracecontext", + }, + ) + test_env_patch.start() + + mock_execute_lambda( + { + "headers": { + TraceContextTextMapPropagator._TRACEPARENT_HEADER_NAME: MOCK_W3C_TRACE_CONTEXT_SAMPLED, + TraceContextTextMapPropagator._TRACESTATE_HEADER_NAME: f"{MOCK_W3C_TRACE_STATE_KEY}={MOCK_W3C_TRACE_STATE_VALUE},foo=1,bar=2", + } + } + ) + + spans = self.memory_exporter.get_finished_spans() + + assert spans + + self.assertEqual(len(spans), 1) + span = spans[0] + self.assertEqual(span.get_span_context().trace_id, MOCK_W3C_TRACE_ID) + + parent_context = span.parent + self.assertEqual( + parent_context.trace_id, span.get_span_context().trace_id + ) + self.assertEqual(parent_context.span_id, MOCK_W3C_PARENT_SPAN_ID) + self.assertEqual(len(parent_context.trace_state), 3) + self.assertEqual( + parent_context.trace_state.get(MOCK_W3C_TRACE_STATE_KEY), + MOCK_W3C_TRACE_STATE_VALUE, + ) + self.assertTrue(parent_context.is_remote) + + test_env_patch.stop() \ No newline at end of file diff --git a/tox.ini b/tox.ini index 6a79be391..3fc1675ab 100644 --- a/tox.ini +++ b/tox.ini @@ -4,6 +4,7 @@ skip_missing_interpreters = True envlist = py3{8,9,10,11}-ao-prod py3{8,9,10,11}-nh-staging + py3{8,9,10,11}-lambda lint [testenv] @@ -30,6 +31,11 @@ setenv = SW_APM_COLLECTOR = apm.collector.st-ssp.solarwinds.com SW_APM_SERVICE_KEY = foo-bar:service-key +[testenv:py3{8,9,10,11}-lambda] +changedir = lambda/tests +commands_pre = + py3{8,9,10,11}-lambda: pip install -r requirements.txt + [testenv:lint] basepython: python3.9 deps = From 7b0c578e30fb0f0630129e187d185b9d8531163f Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 1 Apr 2024 09:46:49 -0700 Subject: [PATCH 47/71] tox install aws-lambda from local --- lambda/tests/requirements.txt | 7 ++++--- lambda/tests/test_instrumentation.py | 25 ++++++++++++------------- tox.ini | 2 ++ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lambda/tests/requirements.txt b/lambda/tests/requirements.txt index 16530d9b7..7b684e049 100644 --- a/lambda/tests/requirements.txt +++ b/lambda/tests/requirements.txt @@ -1,3 +1,4 @@ -# Dependencies used in tests only -opentelemetry-test-utils==0.44b0 -opentelemetry-instrumentation-aws-lambda==0.44b0 \ No newline at end of file +opentelemetry-propagator-aws-xray == 1.0.1 +# This is a gross workaround to test on `custom` branch +# when pyproject.toml doesn't install upstream deps +opentelemetry-instrumentation-logging==0.44b0 \ No newline at end of file diff --git a/lambda/tests/test_instrumentation.py b/lambda/tests/test_instrumentation.py index 03f802cb7..997910030 100644 --- a/lambda/tests/test_instrumentation.py +++ b/lambda/tests/test_instrumentation.py @@ -201,19 +201,18 @@ def test_active_tracing(self): self.assertEqual(span.get_span_context().trace_id, MOCK_XRAY_TRACE_ID) self.assertEqual(span.kind, SpanKind.SERVER) - # TODO: Failing because using PyPI's AwsLambdaInstrumentor - # self.assertSpanHasAttributes( - # span, - # { - # ResourceAttributes.FAAS_ID: MOCK_LAMBDA_CONTEXT.invoked_function_arn, - # SpanAttributes.FAAS_EXECUTION: MOCK_LAMBDA_CONTEXT.aws_request_id, - # ResourceAttributes.CLOUD_ACCOUNT_ID: MOCK_LAMBDA_CONTEXT.invoked_function_arn.split( - # ":" - # )[ - # 4 - # ], - # }, - # ) + self.assertSpanHasAttributes( + span, + { + ResourceAttributes.CLOUD_RESOURCE_ID: MOCK_LAMBDA_CONTEXT.invoked_function_arn, + SpanAttributes.FAAS_INVOCATION_ID: MOCK_LAMBDA_CONTEXT.aws_request_id, + ResourceAttributes.CLOUD_ACCOUNT_ID: MOCK_LAMBDA_CONTEXT.invoked_function_arn.split( + ":" + )[ + 4 + ], + }, + ) parent_context = span.parent self.assertEqual( diff --git a/tox.ini b/tox.ini index 3fc1675ab..f6975e943 100644 --- a/tox.ini +++ b/tox.ini @@ -33,7 +33,9 @@ setenv = [testenv:py3{8,9,10,11}-lambda] changedir = lambda/tests +; Currently installs custom checkout for custom build tests commands_pre = + py3{8,9,10,11}-lambda: pip install -Ie /code/solarwinds_apm/contrib-custom/instrumentation/opentelemetry-instrumentation-aws-lambda py3{8,9,10,11}-lambda: pip install -r requirements.txt [testenv:lint] From b760bac239b2b3c44820f24c8ecf8b0103814e35 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 1 Apr 2024 09:47:09 -0700 Subject: [PATCH 48/71] gitignore for aws-lambda custom tox test --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 34e324db5..7e1fcf3c2 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ share/python-wheels/ *.egg MANIFEST log.txt +tmp-lambda/ # PyInstaller # Usually these files are written by a python script from a template From dd28a83d0e9f73264704ff5c5dc6b24e024c2718 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 1 Apr 2024 10:00:56 -0700 Subject: [PATCH 49/71] Add run_tox job to publish_lambda_layer --- .../workflows/build_publish_lambda_layer.yaml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/build_publish_lambda_layer.yaml b/.github/workflows/build_publish_lambda_layer.yaml index f16b32621..0ed86caf6 100644 --- a/.github/workflows/build_publish_lambda_layer.yaml +++ b/.github/workflows/build_publish_lambda_layer.yaml @@ -19,6 +19,35 @@ on: - production jobs: + run_tox_tests: + runs-on: ubuntu-latest + strategy: + matrix: + python-minor: ["8", "9", "10", "11"] + apm-env: ["lambda"] + steps: + - uses: actions/checkout@v4 + - name: Checkout custom instrumentor + uses: actions/checkout@v4 + with: + repository: tammy-baylis-swi/opentelemetry-python-contrib + ref: build-lambda-handler-exceptions + path: /code/solarwinds_apm/contrib-custom + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: 3.${{ matrix.python-minor }} + cache: 'pip' # caching pip dependencies + cache-dependency-path: | + '**/dev-requirements.txt' + 'lambda/tests/requirements.txt' + - name: Install tox + run: pip install tox + - name: Build extension + run: make wrapper + - name: Run tox + run: tox -e py3${{ matrix.python-minor }}-${{ matrix.apm-env }} + build_publish_layer_x86_64: uses: ./.github/workflows/build_publish_lambda_layer_x86_64.yaml with: From 43306776e0e8deb76c24035e6ae8049f0df3a617 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 1 Apr 2024 10:09:44 -0700 Subject: [PATCH 50/71] Add needs --- .github/workflows/build_publish_lambda_layer.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build_publish_lambda_layer.yaml b/.github/workflows/build_publish_lambda_layer.yaml index 0ed86caf6..48c3ba8e4 100644 --- a/.github/workflows/build_publish_lambda_layer.yaml +++ b/.github/workflows/build_publish_lambda_layer.yaml @@ -49,12 +49,14 @@ jobs: run: tox -e py3${{ matrix.python-minor }}-${{ matrix.apm-env }} build_publish_layer_x86_64: + needs: run_tox_tests uses: ./.github/workflows/build_publish_lambda_layer_x86_64.yaml with: publish-dest: ${{ inputs.publish-dest }} secrets: inherit build_publish_layer_aarch64: + needs: run_tox_tests uses: ./.github/workflows/build_publish_lambda_layer_aarch64.yaml with: publish-dest: ${{ inputs.publish-dest }} From a6a29e996d8286a44674d5843aaeb04f6665550f Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 1 Apr 2024 10:10:32 -0700 Subject: [PATCH 51/71] build_lambda tox assumes runner path for checkout --- .github/workflows/build_publish_lambda_layer.yaml | 4 ++-- tox.ini | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_publish_lambda_layer.yaml b/.github/workflows/build_publish_lambda_layer.yaml index 48c3ba8e4..56f73019b 100644 --- a/.github/workflows/build_publish_lambda_layer.yaml +++ b/.github/workflows/build_publish_lambda_layer.yaml @@ -24,7 +24,7 @@ jobs: strategy: matrix: python-minor: ["8", "9", "10", "11"] - apm-env: ["lambda"] + apm-env: ["lambda-gh"] steps: - uses: actions/checkout@v4 - name: Checkout custom instrumentor @@ -32,7 +32,7 @@ jobs: with: repository: tammy-baylis-swi/opentelemetry-python-contrib ref: build-lambda-handler-exceptions - path: /code/solarwinds_apm/contrib-custom + path: contrib-custom - name: Setup Python uses: actions/setup-python@v5 with: diff --git a/tox.ini b/tox.ini index f6975e943..45777b62d 100644 --- a/tox.ini +++ b/tox.ini @@ -38,6 +38,14 @@ commands_pre = py3{8,9,10,11}-lambda: pip install -Ie /code/solarwinds_apm/contrib-custom/instrumentation/opentelemetry-instrumentation-aws-lambda py3{8,9,10,11}-lambda: pip install -r requirements.txt +[testenv:py3{8,9,10,11}-lambda-gh] +changedir = lambda/tests +; Currently installs custom checkout for custom build tests +; assuming GH runner filepath +commands_pre = + py3{8,9,10,11}-lambda: pip install -Ie /home/runner/work/apm-python/contrib-custom/instrumentation/opentelemetry-instrumentation-aws-lambda + py3{8,9,10,11}-lambda: pip install -r requirements.txt + [testenv:lint] basepython: python3.9 deps = From 831f9ef990e20726c7a26a38ca3c2d6f37699d5b Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Mon, 1 Apr 2024 10:18:20 -0700 Subject: [PATCH 52/71] change path --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 45777b62d..cdac2dfa4 100644 --- a/tox.ini +++ b/tox.ini @@ -43,7 +43,7 @@ changedir = lambda/tests ; Currently installs custom checkout for custom build tests ; assuming GH runner filepath commands_pre = - py3{8,9,10,11}-lambda: pip install -Ie /home/runner/work/apm-python/contrib-custom/instrumentation/opentelemetry-instrumentation-aws-lambda + py3{8,9,10,11}-lambda: pip install -Ie /home/runner/work/apm-python/apm-python/contrib-custom/instrumentation/opentelemetry-instrumentation-aws-lambda py3{8,9,10,11}-lambda: pip install -r requirements.txt [testenv:lint] From 5b27bfbcb5d85e08d253d2d6c02decad7419f452 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 3 Apr 2024 10:28:23 -0700 Subject: [PATCH 53/71] Debug otlp on_start/on_end --- .../trace/otlp_metrics_processor.py | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/solarwinds_apm/trace/otlp_metrics_processor.py b/solarwinds_apm/trace/otlp_metrics_processor.py index facd8d080..628136b10 100644 --- a/solarwinds_apm/trace/otlp_metrics_processor.py +++ b/solarwinds_apm/trace/otlp_metrics_processor.py @@ -5,8 +5,11 @@ # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. import logging +import os from typing import TYPE_CHECKING +from opentelemetry import context as context_api + from solarwinds_apm.apm_constants import ( INTL_SWO_TRANSACTION_ATTR_KEY, INTL_SWO_TRANSACTION_ATTR_MAX, @@ -15,7 +18,7 @@ from solarwinds_apm.trace.base_metrics_processor import _SwBaseMetricsProcessor if TYPE_CHECKING: - from opentelemetry.sdk.trace import ReadableSpan + from opentelemetry.sdk.trace import ReadableSpan, Span from solarwinds_apm.apm_config import SolarWindsApmConfig from solarwinds_apm.apm_txname_manager import SolarWindsTxnNameManager @@ -71,9 +74,33 @@ def calculate_otlp_transaction_name( return "unknown" + def on_start( + self, + span: "Span", + parent_context: Optional[context_api.Context] = None, + ) -> None: + """Debug""" + logger.debug("on_start AWS_LAMBDA_FUNCTION_NAME: %s", os.environ.get("AWS_LAMBDA_FUNCTION_NAME")) + + try: + logger.debug("on_start span: %s", span) + logger.debug("on_start span._name: %s", span._name) + logger.debug("on_start span._attributes: %s", span._attributes) + except Exception as exc: + logger.error("There was a problem with on_start: %s", exc) + def on_end(self, span: "ReadableSpan") -> None: """Calculates and reports OTLP trace metrics""" # Only calculate OTLP metrics for service entry spans + logger.debug("on_end AWS_LAMBDA_FUNCTION_NAME: %s", os.environ.get("AWS_LAMBDA_FUNCTION_NAME")) + + try: + logger.debug("on_end span: %s", span) + logger.debug("on_end span._name: %s", span._name) + logger.debug("on_end span._attributes: %s", span._attributes) + except Exception as exc: + logger.error("There was a problem with on_end: %s", exc) + parent_span_context = span.parent if ( parent_span_context From 5288cfb1c6adf0017e89fcdc3f25aa0a40ff3da3 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 3 Apr 2024 10:28:38 -0700 Subject: [PATCH 54/71] Testrelease 1.7.0.0 --- solarwinds_apm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/version.py b/solarwinds_apm/version.py index e4adfb83d..a8a642eab 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "1.6.0" +__version__ = "1.7.0.0" From b0059f18648550f9f34e7bc5ee93a6209eebbe27 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 3 Apr 2024 10:37:44 -0700 Subject: [PATCH 55/71] Fix import --- solarwinds_apm/trace/otlp_metrics_processor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/trace/otlp_metrics_processor.py b/solarwinds_apm/trace/otlp_metrics_processor.py index 628136b10..6cd37044b 100644 --- a/solarwinds_apm/trace/otlp_metrics_processor.py +++ b/solarwinds_apm/trace/otlp_metrics_processor.py @@ -6,7 +6,7 @@ import logging import os -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Optional from opentelemetry import context as context_api From 4711fb3dac2df85febf407263aa4df69d752e8dd Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 3 Apr 2024 12:15:40 -0700 Subject: [PATCH 56/71] Update default OTEL_PYTHON_LOG_FORMAT --- solarwinds_apm/distro.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/distro.py b/solarwinds_apm/distro.py index 80e521def..d62f7a6bf 100644 --- a/solarwinds_apm/distro.py +++ b/solarwinds_apm/distro.py @@ -94,7 +94,7 @@ def _configure(self, **kwargs): ) environ.setdefault( OTEL_PYTHON_LOG_FORMAT, - "%(asctime)s %(levelname)s [%(name)s] [%(filename)s:%(lineno)d] [trace_id=%(otelTraceID)s span_id=%(otelSpanID)s trace_flags=%(otelTraceSampled)02d resource.service.name=%(otelServiceName)s] - %(message)s", + "%(asctime)s %(levelname)s [%(name)s] [%(filename)s:%(lineno)d] [RequestId=%(requestId)s] [trace_id=%(otelTraceID)s span_id=%(otelSpanID)s trace_flags=%(otelTraceSampled)02d resource.service.name=%(otelServiceName)s] - %(message)s", ) def load_instrumentor(self, entry_point: EntryPoint, **kwargs): From 85f6227dfa2625d8150f14c6a2923dd27fbe77de Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 3 Apr 2024 12:49:32 -0700 Subject: [PATCH 57/71] Custom install logging instrumentor --- Makefile | 5 +++++ lambda/check_lambda_modules.sh | 5 +++++ lambda/requirements-nodeps.txt | 1 - 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ec46b9bd2..83c32ec7a 100644 --- a/Makefile +++ b/Makefile @@ -261,6 +261,11 @@ install-lambda-modules-custom: @echo -e "Directly copying aws-lambda src files" @mkdir ${target_dir}/nodeps/opentelemetry/instrumentation/aws_lambda @cp -r contrib-custom/instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/* ${target_dir}/nodeps/opentelemetry/instrumentation/aws_lambda + @echo -e "Install logging instrumentor from local to include in layer" + @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -Ie contrib-custom/instrumentation/opentelemetry-instrumentation-logging + @echo -e "Directly copying logging src files" + @mkdir ${target_dir}/nodeps/opentelemetry/instrumentation/logging + @cp -r contrib-custom/instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/* ${target_dir}/nodeps/opentelemetry/instrumentation/logging @echo -e "Install solarwinds_apm to be packed up in zip archive to target directory." @/opt/python/cp38-cp38/bin/pip3.8 install . -t ${target_dir}/nodeps --no-deps @echo -e "Removing non-lambda C-extension library files generated by pip install under target directory." diff --git a/lambda/check_lambda_modules.sh b/lambda/check_lambda_modules.sh index 532f23bb1..82ffe99e2 100755 --- a/lambda/check_lambda_modules.sh +++ b/lambda/check_lambda_modules.sh @@ -53,6 +53,11 @@ if [ ! -f "python/opentelemetry/instrumentation/aws_lambda/__init__.py" ]; then exit 1 fi +if [ ! -f "python/opentelemetry/instrumentation/logging/__init__.py" ]; then + echo "FAILED: Missing Logging instrumentor" + exit 1 +fi + expected_otel_files="./python/opentelemetry/exporter/otlp/proto/common/version.py ./python/opentelemetry/exporter/otlp/proto/grpc/version.py ./python/opentelemetry/exporter/otlp/proto/http/version.py diff --git a/lambda/requirements-nodeps.txt b/lambda/requirements-nodeps.txt index 73e132f9d..0e3856fde 100644 --- a/lambda/requirements-nodeps.txt +++ b/lambda/requirements-nodeps.txt @@ -14,7 +14,6 @@ opentelemetry-instrumentation-falcon==0.44b0 opentelemetry-instrumentation-flask==0.44b0 opentelemetry-instrumentation-grpc==0.44b0 opentelemetry-instrumentation-jinja2==0.44b0 -opentelemetry-instrumentation-logging==0.44b0 opentelemetry-instrumentation-mysql==0.44b0 opentelemetry-instrumentation-psycopg2==0.44b0 opentelemetry-instrumentation-pymemcache==0.44b0 From d8d69f14b7a996b264d03cdd9aa69597fefe64d4 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Wed, 3 Apr 2024 12:50:01 -0700 Subject: [PATCH 58/71] Comment out setdefault OTEL_PYTHON_LOG_FORMAT --- solarwinds_apm/distro.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/solarwinds_apm/distro.py b/solarwinds_apm/distro.py index d62f7a6bf..6b50d82f1 100644 --- a/solarwinds_apm/distro.py +++ b/solarwinds_apm/distro.py @@ -92,10 +92,10 @@ def _configure(self, **kwargs): environ.setdefault( OTEL_PROPAGATORS, ",".join(INTL_SWO_DEFAULT_PROPAGATORS) ) - environ.setdefault( - OTEL_PYTHON_LOG_FORMAT, - "%(asctime)s %(levelname)s [%(name)s] [%(filename)s:%(lineno)d] [RequestId=%(requestId)s] [trace_id=%(otelTraceID)s span_id=%(otelSpanID)s trace_flags=%(otelTraceSampled)02d resource.service.name=%(otelServiceName)s] - %(message)s", - ) + # environ.setdefault( + # OTEL_PYTHON_LOG_FORMAT, + # "%(asctime)s %(levelname)s [%(name)s] [%(filename)s:%(lineno)d] [RequestId=%(requestId)s] [trace_id=%(otelTraceID)s span_id=%(otelSpanID)s trace_flags=%(otelTraceSampled)02d resource.service.name=%(otelServiceName)s] - %(message)s", + # ) def load_instrumentor(self, entry_point: EntryPoint, **kwargs): """Takes a collection of instrumentation entry points From 072c8d579daabf2df4199a638dc20c1236bf266d Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Fri, 12 Apr 2024 10:32:20 -0700 Subject: [PATCH 59/71] Revert "Comment out setdefault OTEL_PYTHON_LOG_FORMAT" This reverts commit d8d69f14b7a996b264d03cdd9aa69597fefe64d4. --- solarwinds_apm/distro.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/solarwinds_apm/distro.py b/solarwinds_apm/distro.py index 6b50d82f1..d62f7a6bf 100644 --- a/solarwinds_apm/distro.py +++ b/solarwinds_apm/distro.py @@ -92,10 +92,10 @@ def _configure(self, **kwargs): environ.setdefault( OTEL_PROPAGATORS, ",".join(INTL_SWO_DEFAULT_PROPAGATORS) ) - # environ.setdefault( - # OTEL_PYTHON_LOG_FORMAT, - # "%(asctime)s %(levelname)s [%(name)s] [%(filename)s:%(lineno)d] [RequestId=%(requestId)s] [trace_id=%(otelTraceID)s span_id=%(otelSpanID)s trace_flags=%(otelTraceSampled)02d resource.service.name=%(otelServiceName)s] - %(message)s", - # ) + environ.setdefault( + OTEL_PYTHON_LOG_FORMAT, + "%(asctime)s %(levelname)s [%(name)s] [%(filename)s:%(lineno)d] [RequestId=%(requestId)s] [trace_id=%(otelTraceID)s span_id=%(otelSpanID)s trace_flags=%(otelTraceSampled)02d resource.service.name=%(otelServiceName)s] - %(message)s", + ) def load_instrumentor(self, entry_point: EntryPoint, **kwargs): """Takes a collection of instrumentation entry points From 3397685cf718e908acbe1b1252fbf32ebeb5fec1 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Fri, 12 Apr 2024 10:32:31 -0700 Subject: [PATCH 60/71] Revert "Custom install logging instrumentor" This reverts commit 85f6227dfa2625d8150f14c6a2923dd27fbe77de. --- Makefile | 5 ----- lambda/check_lambda_modules.sh | 5 ----- lambda/requirements-nodeps.txt | 1 + 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 83c32ec7a..ec46b9bd2 100644 --- a/Makefile +++ b/Makefile @@ -261,11 +261,6 @@ install-lambda-modules-custom: @echo -e "Directly copying aws-lambda src files" @mkdir ${target_dir}/nodeps/opentelemetry/instrumentation/aws_lambda @cp -r contrib-custom/instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/* ${target_dir}/nodeps/opentelemetry/instrumentation/aws_lambda - @echo -e "Install logging instrumentor from local to include in layer" - @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/nodeps -Ie contrib-custom/instrumentation/opentelemetry-instrumentation-logging - @echo -e "Directly copying logging src files" - @mkdir ${target_dir}/nodeps/opentelemetry/instrumentation/logging - @cp -r contrib-custom/instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/* ${target_dir}/nodeps/opentelemetry/instrumentation/logging @echo -e "Install solarwinds_apm to be packed up in zip archive to target directory." @/opt/python/cp38-cp38/bin/pip3.8 install . -t ${target_dir}/nodeps --no-deps @echo -e "Removing non-lambda C-extension library files generated by pip install under target directory." diff --git a/lambda/check_lambda_modules.sh b/lambda/check_lambda_modules.sh index 82ffe99e2..532f23bb1 100755 --- a/lambda/check_lambda_modules.sh +++ b/lambda/check_lambda_modules.sh @@ -53,11 +53,6 @@ if [ ! -f "python/opentelemetry/instrumentation/aws_lambda/__init__.py" ]; then exit 1 fi -if [ ! -f "python/opentelemetry/instrumentation/logging/__init__.py" ]; then - echo "FAILED: Missing Logging instrumentor" - exit 1 -fi - expected_otel_files="./python/opentelemetry/exporter/otlp/proto/common/version.py ./python/opentelemetry/exporter/otlp/proto/grpc/version.py ./python/opentelemetry/exporter/otlp/proto/http/version.py diff --git a/lambda/requirements-nodeps.txt b/lambda/requirements-nodeps.txt index 0e3856fde..73e132f9d 100644 --- a/lambda/requirements-nodeps.txt +++ b/lambda/requirements-nodeps.txt @@ -14,6 +14,7 @@ opentelemetry-instrumentation-falcon==0.44b0 opentelemetry-instrumentation-flask==0.44b0 opentelemetry-instrumentation-grpc==0.44b0 opentelemetry-instrumentation-jinja2==0.44b0 +opentelemetry-instrumentation-logging==0.44b0 opentelemetry-instrumentation-mysql==0.44b0 opentelemetry-instrumentation-psycopg2==0.44b0 opentelemetry-instrumentation-pymemcache==0.44b0 From b2daa43a1ddc03819c1717cf9867ce05c05ace8c Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Fri, 12 Apr 2024 10:32:42 -0700 Subject: [PATCH 61/71] Revert "Update default OTEL_PYTHON_LOG_FORMAT" This reverts commit 4711fb3dac2df85febf407263aa4df69d752e8dd. --- solarwinds_apm/distro.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/distro.py b/solarwinds_apm/distro.py index d62f7a6bf..80e521def 100644 --- a/solarwinds_apm/distro.py +++ b/solarwinds_apm/distro.py @@ -94,7 +94,7 @@ def _configure(self, **kwargs): ) environ.setdefault( OTEL_PYTHON_LOG_FORMAT, - "%(asctime)s %(levelname)s [%(name)s] [%(filename)s:%(lineno)d] [RequestId=%(requestId)s] [trace_id=%(otelTraceID)s span_id=%(otelSpanID)s trace_flags=%(otelTraceSampled)02d resource.service.name=%(otelServiceName)s] - %(message)s", + "%(asctime)s %(levelname)s [%(name)s] [%(filename)s:%(lineno)d] [trace_id=%(otelTraceID)s span_id=%(otelSpanID)s trace_flags=%(otelTraceSampled)02d resource.service.name=%(otelServiceName)s] - %(message)s", ) def load_instrumentor(self, entry_point: EntryPoint, **kwargs): From f442eba050bb0e0d8018a35e99ed9843a41d2b39 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Fri, 12 Apr 2024 10:32:52 -0700 Subject: [PATCH 62/71] Revert "Fix import" This reverts commit b0059f18648550f9f34e7bc5ee93a6209eebbe27. --- solarwinds_apm/trace/otlp_metrics_processor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/trace/otlp_metrics_processor.py b/solarwinds_apm/trace/otlp_metrics_processor.py index 6cd37044b..628136b10 100644 --- a/solarwinds_apm/trace/otlp_metrics_processor.py +++ b/solarwinds_apm/trace/otlp_metrics_processor.py @@ -6,7 +6,7 @@ import logging import os -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING from opentelemetry import context as context_api From 9cfb4495f231f9dc0f81517f4c0a53b5aea2cf84 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Fri, 12 Apr 2024 10:33:01 -0700 Subject: [PATCH 63/71] Revert "Debug otlp on_start/on_end" This reverts commit 5b27bfbcb5d85e08d253d2d6c02decad7419f452. --- .../trace/otlp_metrics_processor.py | 29 +------------------ 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/solarwinds_apm/trace/otlp_metrics_processor.py b/solarwinds_apm/trace/otlp_metrics_processor.py index 628136b10..facd8d080 100644 --- a/solarwinds_apm/trace/otlp_metrics_processor.py +++ b/solarwinds_apm/trace/otlp_metrics_processor.py @@ -5,11 +5,8 @@ # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. import logging -import os from typing import TYPE_CHECKING -from opentelemetry import context as context_api - from solarwinds_apm.apm_constants import ( INTL_SWO_TRANSACTION_ATTR_KEY, INTL_SWO_TRANSACTION_ATTR_MAX, @@ -18,7 +15,7 @@ from solarwinds_apm.trace.base_metrics_processor import _SwBaseMetricsProcessor if TYPE_CHECKING: - from opentelemetry.sdk.trace import ReadableSpan, Span + from opentelemetry.sdk.trace import ReadableSpan from solarwinds_apm.apm_config import SolarWindsApmConfig from solarwinds_apm.apm_txname_manager import SolarWindsTxnNameManager @@ -74,33 +71,9 @@ def calculate_otlp_transaction_name( return "unknown" - def on_start( - self, - span: "Span", - parent_context: Optional[context_api.Context] = None, - ) -> None: - """Debug""" - logger.debug("on_start AWS_LAMBDA_FUNCTION_NAME: %s", os.environ.get("AWS_LAMBDA_FUNCTION_NAME")) - - try: - logger.debug("on_start span: %s", span) - logger.debug("on_start span._name: %s", span._name) - logger.debug("on_start span._attributes: %s", span._attributes) - except Exception as exc: - logger.error("There was a problem with on_start: %s", exc) - def on_end(self, span: "ReadableSpan") -> None: """Calculates and reports OTLP trace metrics""" # Only calculate OTLP metrics for service entry spans - logger.debug("on_end AWS_LAMBDA_FUNCTION_NAME: %s", os.environ.get("AWS_LAMBDA_FUNCTION_NAME")) - - try: - logger.debug("on_end span: %s", span) - logger.debug("on_end span._name: %s", span._name) - logger.debug("on_end span._attributes: %s", span._attributes) - except Exception as exc: - logger.error("There was a problem with on_end: %s", exc) - parent_span_context = span.parent if ( parent_span_context From 029889941fc9afbc76eca2dcfefcb344f2ef9e23 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Fri, 12 Apr 2024 10:33:37 -0700 Subject: [PATCH 64/71] Testrelease 1.7.0.1 --- solarwinds_apm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/version.py b/solarwinds_apm/version.py index a8a642eab..411eadb67 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "1.7.0.0" +__version__ = "1.7.0.1" From 08f585a876764abd4392d910c5f432d93fbcacfe Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Tue, 30 Apr 2024 13:52:59 -0700 Subject: [PATCH 65/71] Rename custom-sw-build branch --- .github/workflows/build_publish_lambda_layer.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_publish_lambda_layer.yaml b/.github/workflows/build_publish_lambda_layer.yaml index 56f73019b..9559942cd 100644 --- a/.github/workflows/build_publish_lambda_layer.yaml +++ b/.github/workflows/build_publish_lambda_layer.yaml @@ -31,7 +31,7 @@ jobs: uses: actions/checkout@v4 with: repository: tammy-baylis-swi/opentelemetry-python-contrib - ref: build-lambda-handler-exceptions + ref: custom-sw-build path: contrib-custom - name: Setup Python uses: actions/setup-python@v5 From 97169e440c7d5276ef5929e197331850e6bda3b6 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Tue, 30 Apr 2024 13:56:41 -0700 Subject: [PATCH 66/71] Upgrade Otel Python 1.24.0/0.45b0 --- dev-requirements.txt | 8 ++--- lambda/requirements-custom.txt | 12 +++---- lambda/requirements-nodeps.txt | 58 +++++++++++++++++----------------- lambda/requirements.txt | 8 ++--- lambda/tests/requirements.txt | 2 +- pyproject.toml | 8 ++--- 6 files changed, 48 insertions(+), 48 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 4b4fef0b5..6af57a597 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,9 +1,9 @@ -opentelemetry-test-utils==0.44b0 -opentelemetry-instrumentation-flask==0.44b0 -opentelemetry-instrumentation-requests==0.44b0 +opentelemetry-test-utils==0.45b0 +opentelemetry-instrumentation-flask==0.45b0 +opentelemetry-instrumentation-requests==0.45b0 pytest pytest-cov pytest-mock requests -flask<3.0.0 +flask werkzeug \ No newline at end of file diff --git a/lambda/requirements-custom.txt b/lambda/requirements-custom.txt index 3b14cc487..e1adbb4e5 100644 --- a/lambda/requirements-custom.txt +++ b/lambda/requirements-custom.txt @@ -1,7 +1,7 @@ -opentelemetry-api==1.23.0 -opentelemetry-sdk==1.23.0 -opentelemetry-instrumentation==0.44b0 +opentelemetry-api==1.24.0 +opentelemetry-sdk==1.24.0 +opentelemetry-instrumentation==0.45b0 opentelemetry-propagator-aws-xray==1.0.1 -opentelemetry-exporter-otlp==1.23.0 -opentelemetry-exporter-otlp-proto-grpc==1.23.0 -opentelemetry-exporter-otlp-proto-http==1.23.0 \ No newline at end of file +opentelemetry-exporter-otlp==1.24.0 +opentelemetry-exporter-otlp-proto-grpc==1.24.0 +opentelemetry-exporter-otlp-proto-http==1.24.0 \ No newline at end of file diff --git a/lambda/requirements-nodeps.txt b/lambda/requirements-nodeps.txt index 73e132f9d..8b2a90926 100644 --- a/lambda/requirements-nodeps.txt +++ b/lambda/requirements-nodeps.txt @@ -1,31 +1,31 @@ -opentelemetry-instrumentation-aiohttp-client==0.44b0 -opentelemetry-util-http==0.44b0 +opentelemetry-instrumentation-aiohttp-client==0.45b0 +opentelemetry-util-http==0.45b0 asgiref~=3.8 -opentelemetry-instrumentation-asgi==0.44b0 -opentelemetry-instrumentation-asyncpg==0.44b0 -opentelemetry-instrumentation-boto==0.44b0 -opentelemetry-instrumentation-botocore==0.44b0 -opentelemetry-instrumentation-celery==0.44b0 -opentelemetry-instrumentation-dbapi==0.44b0 -opentelemetry-instrumentation-django==0.44b0 -opentelemetry-instrumentation-elasticsearch==0.44b0 -opentelemetry-instrumentation-fastapi==0.44b0 -opentelemetry-instrumentation-falcon==0.44b0 -opentelemetry-instrumentation-flask==0.44b0 -opentelemetry-instrumentation-grpc==0.44b0 -opentelemetry-instrumentation-jinja2==0.44b0 -opentelemetry-instrumentation-logging==0.44b0 -opentelemetry-instrumentation-mysql==0.44b0 -opentelemetry-instrumentation-psycopg2==0.44b0 -opentelemetry-instrumentation-pymemcache==0.44b0 -opentelemetry-instrumentation-pymongo==0.44b0 -opentelemetry-instrumentation-pymysql==0.44b0 -opentelemetry-instrumentation-pyramid==0.44b0 -opentelemetry-instrumentation-redis==0.44b0 -opentelemetry-instrumentation-requests==0.44b0 -opentelemetry-instrumentation-sqlalchemy==0.44b0 -opentelemetry-instrumentation-sqlite3==0.44b0 -opentelemetry-instrumentation-starlette==0.44b0 -opentelemetry-instrumentation-tornado==0.44b0 -opentelemetry-instrumentation-wsgi==0.44b0 +opentelemetry-instrumentation-asgi==0.45b0 +opentelemetry-instrumentation-asyncpg==0.45b0 +opentelemetry-instrumentation-boto==0.45b0 +opentelemetry-instrumentation-botocore==0.45b0 +opentelemetry-instrumentation-celery==0.45b0 +opentelemetry-instrumentation-dbapi==0.45b0 +opentelemetry-instrumentation-django==0.45b0 +opentelemetry-instrumentation-elasticsearch==0.45b0 +opentelemetry-instrumentation-fastapi==0.45b0 +opentelemetry-instrumentation-falcon==0.45b0 +opentelemetry-instrumentation-flask==0.45b0 +opentelemetry-instrumentation-grpc==0.45b0 +opentelemetry-instrumentation-jinja2==0.45b0 +opentelemetry-instrumentation-logging==0.45b0 +opentelemetry-instrumentation-mysql==0.45b0 +opentelemetry-instrumentation-psycopg2==0.45b0 +opentelemetry-instrumentation-pymemcache==0.45b0 +opentelemetry-instrumentation-pymongo==0.45b0 +opentelemetry-instrumentation-pymysql==0.45b0 +opentelemetry-instrumentation-pyramid==0.45b0 +opentelemetry-instrumentation-redis==0.45b0 +opentelemetry-instrumentation-requests==0.45b0 +opentelemetry-instrumentation-sqlalchemy==0.45b0 +opentelemetry-instrumentation-sqlite3==0.45b0 +opentelemetry-instrumentation-starlette==0.45b0 +opentelemetry-instrumentation-tornado==0.45b0 +opentelemetry-instrumentation-wsgi==0.45b0 packaging>=21.0 diff --git a/lambda/requirements.txt b/lambda/requirements.txt index 63e312d63..593d490c8 100644 --- a/lambda/requirements.txt +++ b/lambda/requirements.txt @@ -1,4 +1,4 @@ -opentelemetry-exporter-otlp==1.23.0 -opentelemetry-exporter-otlp-proto-grpc==1.23.0 -opentelemetry-exporter-otlp-proto-http==1.23.0 -opentelemetry-instrumentation-aws-lambda==0.44b0 +opentelemetry-exporter-otlp==1.24.0 +opentelemetry-exporter-otlp-proto-grpc==1.24.0 +opentelemetry-exporter-otlp-proto-http==1.24.0 +opentelemetry-instrumentation-aws-lambda==0.45b0 diff --git a/lambda/tests/requirements.txt b/lambda/tests/requirements.txt index 7b684e049..0b37d8290 100644 --- a/lambda/tests/requirements.txt +++ b/lambda/tests/requirements.txt @@ -1,4 +1,4 @@ opentelemetry-propagator-aws-xray == 1.0.1 # This is a gross workaround to test on `custom` branch # when pyproject.toml doesn't install upstream deps -opentelemetry-instrumentation-logging==0.44b0 \ No newline at end of file +opentelemetry-instrumentation-logging==0.45b0 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 8e7d6bd9c..8f768c60b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,10 +41,10 @@ classifiers = [ ] requires-python = ">=3.8" dependencies = [ - # 'opentelemetry-api == 1.23.0', - # 'opentelemetry-sdk == 1.23.0', - # 'opentelemetry-instrumentation == 0.44b0', - # 'opentelemetry-instrumentation-logging == 0.44b0', + # 'opentelemetry-api == 1.24.0', + # 'opentelemetry-sdk == 1.24.0', + # 'opentelemetry-instrumentation == 0.45b0', + # 'opentelemetry-instrumentation-logging == 0.45b0', ] [project.urls] From fcf984a1ef80376c66aa58e73e267ce8497fb431 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Tue, 30 Apr 2024 13:58:02 -0700 Subject: [PATCH 67/71] Testrelease 2.0.0.0 --- solarwinds_apm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/version.py b/solarwinds_apm/version.py index 411eadb67..6de091a17 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "1.7.0.1" +__version__ = "2.0.0.0" From 3061f411793e330d4c816f2e1ff8f71a068e3af4 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Tue, 30 Apr 2024 15:19:30 -0700 Subject: [PATCH 68/71] Rm run_tox_test py37 --- .github/workflows/run_tox_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_tox_tests.yaml b/.github/workflows/run_tox_tests.yaml index 2d01576e4..15b796a9a 100644 --- a/.github/workflows/run_tox_tests.yaml +++ b/.github/workflows/run_tox_tests.yaml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-minor: ["7", "8", "9", "10"] + python-minor: ["8", "9", "10", "11"] apm-env: ["nh-staging", "ao-prod"] steps: - uses: actions/checkout@v4 From 39032ddc5d180d0c3627598beadbaed7cfd1a84f Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 16 May 2024 14:11:45 -0700 Subject: [PATCH 69/71] Testrelease 1.7.0.2 (match regular release) --- solarwinds_apm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/version.py b/solarwinds_apm/version.py index a8a642eab..5cd20c3ae 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "1.7.0.0" +__version__ = "1.7.0.2" From 232f90c99e7c01b166174605ca56bf592cbff074 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 16 May 2024 14:53:56 -0700 Subject: [PATCH 70/71] Release 1.7.0 --- solarwinds_apm/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solarwinds_apm/version.py b/solarwinds_apm/version.py index 5cd20c3ae..14d9d2f58 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "1.7.0.2" +__version__ = "1.7.0" From df7b7a765b1a2b23b7a701bb9ce68a44cd521815 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Tue, 4 Jun 2024 11:11:05 -0700 Subject: [PATCH 71/71] Update deps --- dev-requirements.txt | 2 +- lambda/requirements-custom.txt | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index fbd129d29..5ed2ef852 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -5,5 +5,5 @@ pytest pytest-cov pytest-mock requests -flask +flask~=3.0 werkzeug \ No newline at end of file diff --git a/lambda/requirements-custom.txt b/lambda/requirements-custom.txt index e1adbb4e5..7509330da 100644 --- a/lambda/requirements-custom.txt +++ b/lambda/requirements-custom.txt @@ -1,7 +1,7 @@ -opentelemetry-api==1.24.0 -opentelemetry-sdk==1.24.0 -opentelemetry-instrumentation==0.45b0 +opentelemetry-api==1.25.0 +opentelemetry-sdk==1.25.0 +opentelemetry-instrumentation==0.46b0 opentelemetry-propagator-aws-xray==1.0.1 -opentelemetry-exporter-otlp==1.24.0 -opentelemetry-exporter-otlp-proto-grpc==1.24.0 -opentelemetry-exporter-otlp-proto-http==1.24.0 \ No newline at end of file +opentelemetry-exporter-otlp==1.25.0 +opentelemetry-exporter-otlp-proto-grpc==1.25.0 +opentelemetry-exporter-otlp-proto-http==1.25.0 \ No newline at end of file