From 775ab7f690a0f1efc5cdb03b29306e0b02ed0aad Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 29 Aug 2024 14:59:28 -0700 Subject: [PATCH 1/9] Revert "Revert Otel 1.26 upgrade, py312 support" This reverts commit 692055e22dbf5763c2187ba10da06ea9a81ac370. --- .../build_publish_lambda_layer_aarch64.yaml | 2 +- .../build_publish_lambda_layer_x86_64.yaml | 2 +- .github/workflows/run_tox_tests.yaml | 2 +- .github/workflows/verify_install.yaml | 16 +++++ CONTRIBUTING.md | 2 +- Makefile | 10 ++-- dev-requirements.txt | 6 +- lambda/requirements-nodeps.txt | 58 +++++++++---------- lambda/requirements.txt | 8 +-- pyproject.toml | 11 ++-- tests/docker/install/docker-compose.yml | 32 ++++++++++ tox.ini | 22 +++---- 12 files changed, 110 insertions(+), 61 deletions(-) diff --git a/.github/workflows/build_publish_lambda_layer_aarch64.yaml b/.github/workflows/build_publish_lambda_layer_aarch64.yaml index e9512a46..9f16dbb6 100644 --- a/.github/workflows/build_publish_lambda_layer_aarch64.yaml +++ b/.github/workflows/build_publish_lambda_layer_aarch64.yaml @@ -45,6 +45,6 @@ jobs: artifact-name: solarwinds_apm_lambda_aarch64.zip component-version: ${{ needs.build_layer_aarch64.outputs.SW_APM_VERSION }} architecture: arm64 - runtimes: "python3.8 python3.9 python3.10 python3.11" + runtimes: "python3.8 python3.9 python3.10 python3.11 python3.12" 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 67164ff9..f6fc01c0 100644 --- a/.github/workflows/build_publish_lambda_layer_x86_64.yaml +++ b/.github/workflows/build_publish_lambda_layer_x86_64.yaml @@ -39,6 +39,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.8 python3.9 python3.10 python3.11" + runtimes: "python3.8 python3.9 python3.10 python3.11 python3.12" publish-dest: ${{ inputs.publish-dest }} secrets: inherit \ No newline at end of file diff --git a/.github/workflows/run_tox_tests.yaml b/.github/workflows/run_tox_tests.yaml index 15b796a9..55a84f6f 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: ["8", "9", "10", "11"] + python-minor: ["8", "9", "10", "11", "12"] apm-env: ["nh-staging", "ao-prod"] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/verify_install.yaml b/.github/workflows/verify_install.yaml index 9d1fe06a..ff707370 100644 --- a/.github/workflows/verify_install.yaml +++ b/.github/workflows/verify_install.yaml @@ -67,6 +67,10 @@ jobs: - py3.11-alpine3.17 - py3.11-debian10 - py3.11-debian11 + - py3.12-alpine3.19 + - py3.12-alpine3.20 + - py3.12-debian11 + - py3.12-debian12 arch: - x64 - arm64 @@ -121,6 +125,14 @@ jobs: image: python:3.11-buster - hostname: py3.11-debian11 image: python:3.11-bullseye + - hostname: py3.12-alpine3.19 + image: python:3.12-alpine3.19 + - hostname: py3.12-alpine3.20 + image: python:3.12-alpine3.20 + - hostname: py3.12-debian11 + image: python:3.12-bullseye + - hostname: py3.12-debian12 + image: python:3.12-bookworm # Note: JavaScript Actions (checkout) in Alpine only supported in x64 exclude: - hostname: py3.8-alpine3.12 @@ -145,6 +157,10 @@ jobs: arch: arm64 - hostname: py3.11-alpine3.17 arch: arm64 + - hostname: py3.12-alpine3.19 + arch: arm64 + - hostname: py3.12-alpine3.20 + arch: arm64 container: image: "${{ matrix.image }}" options: --hostname "${{ matrix.hostname }}" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7545efb6..f5f1343d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,7 +44,7 @@ docker-compose run aarch64 ### Regression Tests -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: +Automated testing of this repo uses [tox](https://tox.readthedocs.io) and runs in Python 3.8, 3.9, 3.10, 3.11 and/or 3.12 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. diff --git a/Makefile b/Makefile index 95cae169..ec706e75 100644 --- a/Makefile +++ b/Makefile @@ -168,7 +168,7 @@ check-sdist-local: # in the corresponding repo of the Docker images: https://github.com/pypa/manylinux#example. manylinux-wheels: wrapper @echo -e "Generating python agent package any-linux wheels for 64 bit systems" - @set -e; for PYBIN in cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311; do /opt/python/$${PYBIN}/bin/pip -v wheel . -w ./tmp_dist/ --no-deps; done + @set -e; for PYBIN in cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312; do /opt/python/$${PYBIN}/bin/pip -v wheel . -w ./tmp_dist/ --no-deps; done @echo -e "Tagging wheels with $(wheel_tag)" @set -e; for whl in ./tmp_dist/*.whl; do auditwheel repair --plat $(wheel_tag) "$$whl" -w ./dist/; done @rm -rf ./tmp_dist @@ -194,9 +194,9 @@ install-lambda-modules: @echo -e "Install upstream dependencies to include in layer" @/opt/python/cp38-cp38/bin/pip3.8 install -t ${target_dir}/python -r lambda/requirements.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 + @set -e; for PYBIN in cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312; 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 cp312-cp312; 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 cp312-cp312; 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 -e "Install solarwinds_apm to be packed up in zip archive to target directory." @@ -204,7 +204,7 @@ install-lambda-modules: @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 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 cp312-cp312; 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" diff --git a/dev-requirements.txt b/dev-requirements.txt index 5ed2ef85..4d9ce38d 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ -opentelemetry-test-utils==0.46b0 -opentelemetry-instrumentation-flask==0.46b0 -opentelemetry-instrumentation-requests==0.46b0 +opentelemetry-test-utils==0.47b0 +opentelemetry-instrumentation-flask==0.47b0 +opentelemetry-instrumentation-requests==0.47b0 pytest pytest-cov pytest-mock diff --git a/lambda/requirements-nodeps.txt b/lambda/requirements-nodeps.txt index 1659a541..0d20fbc1 100644 --- a/lambda/requirements-nodeps.txt +++ b/lambda/requirements-nodeps.txt @@ -1,30 +1,30 @@ -opentelemetry-instrumentation-aiohttp-client==0.46b0 -opentelemetry-util-http==0.46b0 +opentelemetry-instrumentation-aiohttp-client==0.47b0 +opentelemetry-util-http==0.47b0 asgiref~=3.8 -opentelemetry-instrumentation-asgi==0.46b0 -opentelemetry-instrumentation-asyncpg==0.46b0 -opentelemetry-instrumentation-boto==0.46b0 -opentelemetry-instrumentation-botocore==0.46b0 -opentelemetry-instrumentation-celery==0.46b0 -opentelemetry-instrumentation-dbapi==0.46b0 -opentelemetry-instrumentation-django==0.46b0 -opentelemetry-instrumentation-elasticsearch==0.46b0 -opentelemetry-instrumentation-fastapi==0.46b0 -opentelemetry-instrumentation-falcon==0.46b0 -opentelemetry-instrumentation-flask==0.46b0 -opentelemetry-instrumentation-grpc==0.46b0 -opentelemetry-instrumentation-jinja2==0.46b0 -opentelemetry-instrumentation-logging==0.46b0 -opentelemetry-instrumentation-mysql==0.46b0 -opentelemetry-instrumentation-psycopg2==0.46b0 -opentelemetry-instrumentation-pymemcache==0.46b0 -opentelemetry-instrumentation-pymongo==0.46b0 -opentelemetry-instrumentation-pymysql==0.46b0 -opentelemetry-instrumentation-pyramid==0.46b0 -opentelemetry-instrumentation-redis==0.46b0 -opentelemetry-instrumentation-requests==0.46b0 -opentelemetry-instrumentation-sqlalchemy==0.46b0 -opentelemetry-instrumentation-sqlite3==0.46b0 -opentelemetry-instrumentation-starlette==0.46b0 -opentelemetry-instrumentation-tornado==0.46b0 -opentelemetry-instrumentation-wsgi==0.46b0 \ No newline at end of file +opentelemetry-instrumentation-asgi==0.47b0 +opentelemetry-instrumentation-asyncpg==0.47b0 +opentelemetry-instrumentation-boto==0.47b0 +opentelemetry-instrumentation-botocore==0.47b0 +opentelemetry-instrumentation-celery==0.47b0 +opentelemetry-instrumentation-dbapi==0.47b0 +opentelemetry-instrumentation-django==0.47b0 +opentelemetry-instrumentation-elasticsearch==0.47b0 +opentelemetry-instrumentation-fastapi==0.47b0 +opentelemetry-instrumentation-falcon==0.47b0 +opentelemetry-instrumentation-flask==0.47b0 +opentelemetry-instrumentation-grpc==0.47b0 +opentelemetry-instrumentation-jinja2==0.47b0 +opentelemetry-instrumentation-logging==0.47b0 +opentelemetry-instrumentation-mysql==0.47b0 +opentelemetry-instrumentation-psycopg2==0.47b0 +opentelemetry-instrumentation-pymemcache==0.47b0 +opentelemetry-instrumentation-pymongo==0.47b0 +opentelemetry-instrumentation-pymysql==0.47b0 +opentelemetry-instrumentation-pyramid==0.47b0 +opentelemetry-instrumentation-redis==0.47b0 +opentelemetry-instrumentation-requests==0.47b0 +opentelemetry-instrumentation-sqlalchemy==0.47b0 +opentelemetry-instrumentation-sqlite3==0.47b0 +opentelemetry-instrumentation-starlette==0.47b0 +opentelemetry-instrumentation-tornado==0.47b0 +opentelemetry-instrumentation-wsgi==0.47b0 \ No newline at end of file diff --git a/lambda/requirements.txt b/lambda/requirements.txt index 9c5e71fa..1aa18ba7 100644 --- a/lambda/requirements.txt +++ b/lambda/requirements.txt @@ -1,7 +1,7 @@ -opentelemetry-exporter-otlp==1.25.0 -opentelemetry-exporter-otlp-proto-grpc==1.25.0 -opentelemetry-exporter-otlp-proto-http==1.25.0 -opentelemetry-instrumentation-aws-lambda==0.46b0 +opentelemetry-exporter-otlp==1.26.0 +opentelemetry-exporter-otlp-proto-grpc==1.26.0 +opentelemetry-exporter-otlp-proto-http==1.26.0 +opentelemetry-instrumentation-aws-lambda==0.47b0 packaging jaraco.text platformdirs diff --git a/pyproject.toml b/pyproject.toml index 7ba71aad..b8aac5b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Typing :: Typed", "Development Status :: 4 - Beta", "Intended Audience :: Developers", @@ -41,11 +42,11 @@ classifiers = [ ] requires-python = ">=3.8" dependencies = [ - 'opentelemetry-api == 1.25.0', - 'opentelemetry-sdk == 1.25.0', - 'opentelemetry-exporter-otlp == 1.25.0', - 'opentelemetry-instrumentation == 0.46b0', - 'opentelemetry-instrumentation-logging == 0.46b0', + 'opentelemetry-api == 1.26.0', + 'opentelemetry-sdk == 1.26.0', + 'opentelemetry-exporter-otlp == 1.26.0', + 'opentelemetry-instrumentation == 0.47b0', + 'opentelemetry-instrumentation-logging == 0.47b0', ] [project.urls] diff --git a/tests/docker/install/docker-compose.yml b/tests/docker/install/docker-compose.yml index e25b6c2e..41c4087e 100755 --- a/tests/docker/install/docker-compose.yml +++ b/tests/docker/install/docker-compose.yml @@ -229,3 +229,35 @@ services: << : [*command-install-test, *workdir, *volumes-codebase] environment: << : *envvars-install-test + + #-------------------------------------------------------------------- + # Python 3.12 + #-------------------------------------------------------------------- + + py3.12-install-debian11: + hostname: "py3.12-debian11" + image: "python:3.12-bullseye" + << : [*command-install-test, *workdir, *volumes-codebase] + environment: + << : *envvars-install-test + + py3.12-install-debian12: + hostname: "py3.12-debian12" + image: "python:3.12-bookworm" + << : [*command-install-test, *workdir, *volumes-codebase] + environment: + << : *envvars-install-test + + py3.12-install-alpine3.19: + hostname: "py3.12-alpine3.19" + image: "python:3.12-alpine3.19" + << : [*command-install-test, *workdir, *volumes-codebase] + environment: + << : *envvars-install-test + + py3.12-install-alpine3.20: + hostname: "py3.12-alpine3.20" + image: "python:3.12-alpine3.20" + << : [*command-install-test, *workdir, *volumes-codebase] + environment: + << : *envvars-install-test \ No newline at end of file diff --git a/tox.ini b/tox.ini index 8044bcec..4f6998e3 100644 --- a/tox.ini +++ b/tox.ini @@ -2,9 +2,9 @@ skipsdist = True 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 + py3{8,9,10,11,12}-ao-prod + py3{8,9,10,11,12}-nh-staging + py3{8,9,10,11,12}-lambda lint [testenv] @@ -15,31 +15,31 @@ allowlist_externals = echo deps = -rdev-requirements.txt commands_pre = - py3{8,9,10,11}: pip install --upgrade pip - py3{8,9,10,11}: pip install -Ie {toxinidir} + py3{8,9,10,11,12}: pip install --upgrade pip + py3{8,9,10,11,12}: pip install -Ie {toxinidir} commands = pytest {posargs} -[testenv:py3{8,9,10,11}-ao-prod] +[testenv:py3{8,9,10,11,12}-ao-prod] changedir = tests setenv = SW_APM_COLLECTOR = collector.appoptics.com SW_APM_SERVICE_KEY = foo-bar:service-key -[testenv:py3{8,9,10,11}-nh-staging] +[testenv:py3{8,9,10,11,12}-nh-staging] changedir = tests 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] +[testenv:py3{8,9,10,11,12}-lambda] changedir = lambda/tests commands_pre = - py3{8,9,10,11}-lambda: pip install -r requirements.txt + py3{8,9,10,11,12}-lambda: pip install -r requirements.txt -[testenv:py3{8,9,10,11}-lambda-gh] +[testenv:py3{8,9,10,11,12}-lambda-gh] changedir = lambda/tests commands_pre = - py3{8,9,10,11}-lambda: pip install -r requirements.txt + py3{8,9,10,11,12}-lambda: pip install -r requirements.txt [testenv:lint] basepython: python3.9 From 4190560985c280e6a0cabd31a0e26d4fe750f5b0 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 29 Aug 2024 15:05:36 -0700 Subject: [PATCH 2/9] Upgrade Otel 1.27.0/0.48b0 --- dev-requirements.txt | 6 ++-- lambda/requirements-nodeps.txt | 58 +++++++++++++++++----------------- lambda/requirements.txt | 8 ++--- lambda/tests/requirements.txt | 2 +- pyproject.toml | 10 +++--- 5 files changed, 42 insertions(+), 42 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 4d9ce38d..17dc08b0 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ -opentelemetry-test-utils==0.47b0 -opentelemetry-instrumentation-flask==0.47b0 -opentelemetry-instrumentation-requests==0.47b0 +opentelemetry-test-utils==0.48b0 +opentelemetry-instrumentation-flask==0.48b0 +opentelemetry-instrumentation-requests==0.48b0 pytest pytest-cov pytest-mock diff --git a/lambda/requirements-nodeps.txt b/lambda/requirements-nodeps.txt index 0d20fbc1..ea4221b6 100644 --- a/lambda/requirements-nodeps.txt +++ b/lambda/requirements-nodeps.txt @@ -1,30 +1,30 @@ -opentelemetry-instrumentation-aiohttp-client==0.47b0 -opentelemetry-util-http==0.47b0 +opentelemetry-instrumentation-aiohttp-client==0.48b0 +opentelemetry-util-http==0.48b0 asgiref~=3.8 -opentelemetry-instrumentation-asgi==0.47b0 -opentelemetry-instrumentation-asyncpg==0.47b0 -opentelemetry-instrumentation-boto==0.47b0 -opentelemetry-instrumentation-botocore==0.47b0 -opentelemetry-instrumentation-celery==0.47b0 -opentelemetry-instrumentation-dbapi==0.47b0 -opentelemetry-instrumentation-django==0.47b0 -opentelemetry-instrumentation-elasticsearch==0.47b0 -opentelemetry-instrumentation-fastapi==0.47b0 -opentelemetry-instrumentation-falcon==0.47b0 -opentelemetry-instrumentation-flask==0.47b0 -opentelemetry-instrumentation-grpc==0.47b0 -opentelemetry-instrumentation-jinja2==0.47b0 -opentelemetry-instrumentation-logging==0.47b0 -opentelemetry-instrumentation-mysql==0.47b0 -opentelemetry-instrumentation-psycopg2==0.47b0 -opentelemetry-instrumentation-pymemcache==0.47b0 -opentelemetry-instrumentation-pymongo==0.47b0 -opentelemetry-instrumentation-pymysql==0.47b0 -opentelemetry-instrumentation-pyramid==0.47b0 -opentelemetry-instrumentation-redis==0.47b0 -opentelemetry-instrumentation-requests==0.47b0 -opentelemetry-instrumentation-sqlalchemy==0.47b0 -opentelemetry-instrumentation-sqlite3==0.47b0 -opentelemetry-instrumentation-starlette==0.47b0 -opentelemetry-instrumentation-tornado==0.47b0 -opentelemetry-instrumentation-wsgi==0.47b0 \ No newline at end of file +opentelemetry-instrumentation-asgi==0.48b0 +opentelemetry-instrumentation-asyncpg==0.48b0 +opentelemetry-instrumentation-boto==0.48b0 +opentelemetry-instrumentation-botocore==0.48b0 +opentelemetry-instrumentation-celery==0.48b0 +opentelemetry-instrumentation-dbapi==0.48b0 +opentelemetry-instrumentation-django==0.48b0 +opentelemetry-instrumentation-elasticsearch==0.48b0 +opentelemetry-instrumentation-fastapi==0.48b0 +opentelemetry-instrumentation-falcon==0.48b0 +opentelemetry-instrumentation-flask==0.48b0 +opentelemetry-instrumentation-grpc==0.48b0 +opentelemetry-instrumentation-jinja2==0.48b0 +opentelemetry-instrumentation-logging==0.48b0 +opentelemetry-instrumentation-mysql==0.48b0 +opentelemetry-instrumentation-psycopg2==0.48b0 +opentelemetry-instrumentation-pymemcache==0.48b0 +opentelemetry-instrumentation-pymongo==0.48b0 +opentelemetry-instrumentation-pymysql==0.48b0 +opentelemetry-instrumentation-pyramid==0.48b0 +opentelemetry-instrumentation-redis==0.48b0 +opentelemetry-instrumentation-requests==0.48b0 +opentelemetry-instrumentation-sqlalchemy==0.48b0 +opentelemetry-instrumentation-sqlite3==0.48b0 +opentelemetry-instrumentation-starlette==0.48b0 +opentelemetry-instrumentation-tornado==0.48b0 +opentelemetry-instrumentation-wsgi==0.48b0 \ No newline at end of file diff --git a/lambda/requirements.txt b/lambda/requirements.txt index 1aa18ba7..a074a609 100644 --- a/lambda/requirements.txt +++ b/lambda/requirements.txt @@ -1,7 +1,7 @@ -opentelemetry-exporter-otlp==1.26.0 -opentelemetry-exporter-otlp-proto-grpc==1.26.0 -opentelemetry-exporter-otlp-proto-http==1.26.0 -opentelemetry-instrumentation-aws-lambda==0.47b0 +opentelemetry-exporter-otlp==1.27.0 +opentelemetry-exporter-otlp-proto-grpc==1.27.0 +opentelemetry-exporter-otlp-proto-http==1.27.0 +opentelemetry-instrumentation-aws-lambda==0.48b0 packaging jaraco.text platformdirs diff --git a/lambda/tests/requirements.txt b/lambda/tests/requirements.txt index 8c3ea8a5..ecc0e83d 100644 --- a/lambda/tests/requirements.txt +++ b/lambda/tests/requirements.txt @@ -1,2 +1,2 @@ -opentelemetry-instrumentation-aws-lambda == 0.46b0 +opentelemetry-instrumentation-aws-lambda == 0.48b0 opentelemetry-propagator-aws-xray == 1.0.1 diff --git a/pyproject.toml b/pyproject.toml index b8aac5b2..fddb94e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,11 +42,11 @@ classifiers = [ ] requires-python = ">=3.8" dependencies = [ - 'opentelemetry-api == 1.26.0', - 'opentelemetry-sdk == 1.26.0', - 'opentelemetry-exporter-otlp == 1.26.0', - 'opentelemetry-instrumentation == 0.47b0', - 'opentelemetry-instrumentation-logging == 0.47b0', + 'opentelemetry-api == 1.27.0', + 'opentelemetry-sdk == 1.27.0', + 'opentelemetry-exporter-otlp == 1.27.0', + 'opentelemetry-instrumentation == 0.48b0', + 'opentelemetry-instrumentation-logging == 0.48b0', ] [project.urls] From 6bafa98da6a9fd6c7982f1bbabf4b2759db63511 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 29 Aug 2024 15:06:15 -0700 Subject: [PATCH 3/9] Upgrade opentelemetry-propagator-aws-xray 1.0.2 --- lambda/tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lambda/tests/requirements.txt b/lambda/tests/requirements.txt index ecc0e83d..49372b15 100644 --- a/lambda/tests/requirements.txt +++ b/lambda/tests/requirements.txt @@ -1,2 +1,2 @@ opentelemetry-instrumentation-aws-lambda == 0.48b0 -opentelemetry-propagator-aws-xray == 1.0.1 +opentelemetry-propagator-aws-xray == 1.0.2 From cfa2754091007586d0de0fdff8a874f8bfb24699 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 29 Aug 2024 15:26:27 -0700 Subject: [PATCH 4/9] Revert "setdefault aws-lambda disabled instr if outside lambda" This reverts commit 4b7873b5556e460adb8a38d77be23d37ca432f0a. --- solarwinds_apm/distro.py | 14 -------------- tests/unit/test_distro.py | 12 ------------ 2 files changed, 26 deletions(-) diff --git a/solarwinds_apm/distro.py b/solarwinds_apm/distro.py index 76f092e4..bc73f98e 100644 --- a/solarwinds_apm/distro.py +++ b/solarwinds_apm/distro.py @@ -18,9 +18,6 @@ OTEL_TRACES_EXPORTER, ) from opentelemetry.instrumentation.distro import BaseDistro -from opentelemetry.instrumentation.environment_variables import ( - OTEL_PYTHON_DISABLED_INSTRUMENTATIONS, -) from opentelemetry.instrumentation.instrumentor import BaseInstrumentor from opentelemetry.instrumentation.logging.environment_variables import ( OTEL_PYTHON_LOG_FORMAT, @@ -142,17 +139,6 @@ def _configure(self, **kwargs): # Always opt into new semconv for all instrumentors (if supported) environ["OTEL_SEMCONV_STABILITY_OPT_IN"] = self.get_semconv_opt_in() - # TODO: Bootstrapping and auto-instrumentation ideally - # should not load instrumentor nor instrument AWS Lambda if not in lambda - if not SolarWindsApmConfig.calculate_is_lambda(): - # If user has set OTEL_PYTHON_DISABLED_INSTRUMENTATIONS - # then they will need to add "aws-lambda" to the list - # else instrumentor Version Lookups for attributes may fail - environ.setdefault( - OTEL_PYTHON_DISABLED_INSTRUMENTATIONS, - "aws-lambda", - ) - def load_instrumentor(self, entry_point: EntryPoint, **kwargs): """Takes a collection of instrumentation entry points and activates them by instantiating and calling instrument() diff --git a/tests/unit/test_distro.py b/tests/unit/test_distro.py index 1d7065a0..bcd609bb 100644 --- a/tests/unit/test_distro.py +++ b/tests/unit/test_distro.py @@ -13,9 +13,6 @@ OTEL_PROPAGATORS, OTEL_TRACES_EXPORTER ) -from opentelemetry.instrumentation.environment_variables import ( - OTEL_PYTHON_DISABLED_INSTRUMENTATIONS, -) from opentelemetry.sdk.environment_variables import ( OTEL_EXPORTER_OTLP_LOGS_ENDPOINT, OTEL_EXPORTER_OTLP_LOGS_HEADERS, @@ -300,15 +297,6 @@ def test_configure_env_propagators(self, mocker): assert os.environ[OTEL_TRACES_EXPORTER] == "solarwinds_exporter" assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http" - def test_configure_env_disabled_instrumentations_default(self): - distro.SolarWindsDistro()._configure() - assert os.environ[OTEL_PYTHON_DISABLED_INSTRUMENTATIONS] == "aws-lambda" - - def test_configure_env_disabled_instrumentations_user_set(self, mocker): - mocker.patch.dict(os.environ, {"OTEL_PYTHON_DISABLED_INSTRUMENTATIONS": "foo-bar,only"}) - distro.SolarWindsDistro()._configure() - assert os.environ[OTEL_PYTHON_DISABLED_INSTRUMENTATIONS] == "foo-bar,only" - def test_load_instrumentor_no_commenting(self, mocker): mock_instrument = mocker.Mock() mock_instrumentor = mocker.Mock() From 4af8c14169bf2888f547ab3c2d05409612fe4987 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 29 Aug 2024 15:40:39 -0700 Subject: [PATCH 5/9] Testrelease 2.2.1.6 --- 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 e80ebf91..d0aeb84a 100644 --- a/solarwinds_apm/version.py +++ b/solarwinds_apm/version.py @@ -1 +1 @@ -__version__ = "2.2.1.5" +__version__ = "2.2.1.6" From c47709e8b8ce969055eb4a63bbbfd3141884ffff Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 29 Aug 2024 16:01:21 -0700 Subject: [PATCH 6/9] Fix lambda test_instrumentation after upgrade --- lambda/tests/test_instrumentation.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lambda/tests/test_instrumentation.py b/lambda/tests/test_instrumentation.py index 99791003..c7740020 100644 --- a/lambda/tests/test_instrumentation.py +++ b/lambda/tests/test_instrumentation.py @@ -13,10 +13,11 @@ import os import subprocess import sys -from importlib import import_module +from importlib import import_module, reload from shutil import which from unittest import mock +from opentelemetry import propagate from opentelemetry.environment_variables import OTEL_PROPAGATORS from opentelemetry.instrumentation.aws_lambda import ( _HANDLER, @@ -182,10 +183,12 @@ def test_active_tracing(self): { **os.environ, # Using Active tracing + OTEL_PROPAGATORS: "xray-lambda", _X_AMZN_TRACE_ID: MOCK_XRAY_TRACE_CONTEXT_SAMPLED, }, ) test_env_patch.start() + reload(propagate) AwsLambdaInstrumentor().instrument() @@ -235,6 +238,7 @@ def test_parent_context_from_lambda_event(self): }, ) test_env_patch.start() + reload(propagate) mock_execute_lambda( { From fbb824e383b237d52706c4bcfc1cb3a113ce9fde Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 29 Aug 2024 16:29:06 -0700 Subject: [PATCH 7/9] Update check_lambda_modules for pep 420 updates --- lambda/check_lambda_modules.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lambda/check_lambda_modules.sh b/lambda/check_lambda_modules.sh index 532f23bb..6b34d891 100755 --- a/lambda/check_lambda_modules.sh +++ b/lambda/check_lambda_modules.sh @@ -57,14 +57,21 @@ expected_otel_files="./python/opentelemetry/exporter/otlp/proto/common/version.p ./python/opentelemetry/exporter/otlp/proto/grpc/version.py ./python/opentelemetry/exporter/otlp/proto/http/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) +./python/opentelemetry/instrumentation/botocore/version.py" +found_otel_files=$(find ./python/opentelemetry/exporter ./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" exit 1 fi +# An additional check for those packages now following PEP 420 +expected_otel_files_pep420="./python/opentelemetry/sdk/version/__init__.py" +found_otel_files_pep420=$(find ./python/opentelemetry/sdk -regextype sed -regex ".*/version/__init__.py" | sort -k1) +if [[ ! "$found_otel_files_pep420" =~ $expected_otel_files_pep420 ]]; then + echo "FAILED: Missing key opentelemetry dependency version files (PEP 420)" + exit 1 +fi + cd "$pwd" echo "Successfully verified lambda files and modules for layer archive" exit 0 From 50191c760d7b118360425afe1b6534cec428fb6d Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 29 Aug 2024 16:51:23 -0700 Subject: [PATCH 8/9] Add setuptools to lambda deps --- lambda/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/lambda/requirements.txt b/lambda/requirements.txt index a074a609..d708e40c 100644 --- a/lambda/requirements.txt +++ b/lambda/requirements.txt @@ -5,3 +5,4 @@ opentelemetry-instrumentation-aws-lambda==0.48b0 packaging jaraco.text platformdirs +setuptools From 7d6b43a234e9d90ec60d8d2740b7a30470c25b45 Mon Sep 17 00:00:00 2001 From: tammy-baylis-swi Date: Thu, 29 Aug 2024 16:57:54 -0700 Subject: [PATCH 9/9] Don't remove setuptools from lambda layer --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ec706e75..433701bc 100644 --- a/Makefile +++ b/Makefile @@ -215,10 +215,9 @@ install-lambda-modules: @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" + @echo -e "Removing unnecessary boto, six, 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