Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NH-79315 Upgrade Otel Python 1.25/0.46b0 #364

Merged
merged 21 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_publish_lambda_layer_x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/run_tox_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/verify_install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/solarwinds/apm-python/compare/rel-1.6.0...HEAD)

### Changed
- OpenTelemetry API/SDK and instrumentation 1.25.0/0.46b0 ([#364](https://github.com/solarwinds/apm-python/pull/364))

## [1.6.0](https://github.com/solarwinds/apm-python/releases/tag/rel-1.6.0) - 2024-04-02

### Added
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 /opt/python/*/bin; do if [ "$${PYBIN}" != "/opt/python/cp36-cp36m/bin" ]; then "$${PYBIN}/pip" -v wheel . -w ./tmp_dist/ --no-deps; fi; done
@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
@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
Expand Down Expand Up @@ -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 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"
Expand Down Expand Up @@ -293,7 +293,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)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
8 changes: 4 additions & 4 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
opentelemetry-test-utils==0.41b0
opentelemetry-instrumentation-flask==0.41b0
opentelemetry-instrumentation-requests==0.41b0
opentelemetry-test-utils==0.46b0
opentelemetry-instrumentation-flask==0.46b0
opentelemetry-instrumentation-requests==0.46b0
pytest
pytest-cov
pytest-mock
requests
flask<3.0.0
flask~=3.0
werkzeug
58 changes: 29 additions & 29 deletions lambda/requirements-nodeps.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
opentelemetry-instrumentation-aiohttp-client==0.41b0
opentelemetry-util-http==0.41b0
opentelemetry-instrumentation-aiohttp-client==0.46b0
opentelemetry-util-http==0.46b0
asgiref~=3.8
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
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
8 changes: 4 additions & 4 deletions lambda/requirements.txt
Original file line number Diff line number Diff line change
@@ -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.25.0
opentelemetry-exporter-otlp-proto-grpc==1.25.0
opentelemetry-exporter-otlp-proto-http==1.25.0
opentelemetry-instrumentation-aws-lambda==0.46b0
11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -40,12 +39,12 @@ classifiers = [
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [
'opentelemetry-api == 1.20.0',
'opentelemetry-sdk == 1.20.0',
'opentelemetry-instrumentation == 0.41b0',
'opentelemetry-instrumentation-logging == 0.41b0',
'opentelemetry-api == 1.25.0',
'opentelemetry-sdk == 1.25.0',
'opentelemetry-instrumentation == 0.46b0',
'opentelemetry-instrumentation-logging == 0.46b0',
]

[project.urls]
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -132,5 +132,5 @@ def run(self):
'build_py': CustomBuild,
},
ext_modules=ext_modules,
python_requires='>=3.7',
python_requires='>=3.8',
)
3 changes: 2 additions & 1 deletion solarwinds_apm/apm_meter_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 16 additions & 0 deletions solarwinds_apm/distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ def _configure(self, **kwargs):
"%(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",
)

# TODO: Support other signal types when available
# Always opt into new semconv for all instrumentors (if supported)
environ["OTEL_SEMCONV_STABILITY_OPT_IN"] = self.get_semconv_opt_in()

def load_instrumentor(self, entry_point: EntryPoint, **kwargs):
"""Takes a collection of instrumentation entry points
and activates them by instantiating and calling instrument()
Expand Down Expand Up @@ -157,3 +161,15 @@ def detect_commenter_options(self):
commenter_opts[opt_k.strip()] = opt_v_bool

return commenter_opts

def get_semconv_opt_in(self):
"""
Always returns semconv config as opt-into new, stable HTTP only

See also:
https://github.com/open-telemetry/opentelemetry-python-contrib/blob/0a231e57f9722e6101194c6b38695addf23ab950/opentelemetry-instrumentation/src/opentelemetry/instrumentation/_semconv.py#L93-L99
"""
# TODO: Support other signal types when available
# return environ.get("OTEL_SEMCONV_STABILITY_OPT_IN")

return "http"
2 changes: 1 addition & 1 deletion solarwinds_apm/propagator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion solarwinds_apm/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,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],
Expand Down
2 changes: 1 addition & 1 deletion solarwinds_apm/trace/txnname_calculator_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/docker/install/_helper_run_install_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/"//')
Expand Down
46 changes: 0 additions & 46 deletions tests/docker/install/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
#--------------------------------------------------------------------
Expand Down
Loading
Loading