From 9b726cb1aaa4fcab409e16b494a0f1f1b855ff47 Mon Sep 17 00:00:00 2001 From: Owais Lone Date: Tue, 25 May 2021 06:01:29 +0530 Subject: [PATCH] WIP: depends on PR 475 wip wip --- .../setup.py | 2 -- .../opentelemetry-instrumentation-aiopg/setup.py | 2 -- .../opentelemetry-instrumentation-asgi/setup.py | 2 -- .../opentelemetry-instrumentation-asyncpg/setup.py | 2 -- .../opentelemetry-instrumentation-boto/setup.py | 2 -- .../opentelemetry-instrumentation-botocore/setup.py | 2 -- .../opentelemetry-instrumentation-celery/setup.py | 2 -- .../opentelemetry-instrumentation-dbapi/setup.py | 2 -- .../opentelemetry-instrumentation-django/setup.py | 2 -- .../setup.py | 2 -- .../opentelemetry-instrumentation-falcon/setup.py | 2 -- .../opentelemetry-instrumentation-fastapi/setup.py | 2 -- .../opentelemetry-instrumentation-flask/setup.py | 2 -- .../opentelemetry-instrumentation-grpc/setup.py | 2 -- .../opentelemetry-instrumentation-jinja2/setup.py | 2 -- .../opentelemetry-instrumentation-logging/setup.py | 2 -- .../opentelemetry-instrumentation-mysql/setup.py | 2 -- .../opentelemetry-instrumentation-psycopg2/setup.py | 2 -- .../opentelemetry-instrumentation-pymemcache/setup.py | 2 -- .../opentelemetry-instrumentation-pymongo/setup.py | 2 -- .../opentelemetry-instrumentation-pymysql/setup.py | 2 -- .../opentelemetry-instrumentation-pyramid/setup.py | 2 -- .../opentelemetry-instrumentation-redis/setup.py | 2 -- .../opentelemetry-instrumentation-requests/setup.py | 2 -- .../opentelemetry-instrumentation-sklearn/setup.py | 2 -- .../opentelemetry-instrumentation-sqlalchemy/setup.py | 2 -- .../opentelemetry-instrumentation-sqlite3/setup.py | 2 -- .../opentelemetry-instrumentation-starlette/setup.py | 2 -- .../opentelemetry-instrumentation-tornado/setup.py | 2 -- .../opentelemetry-instrumentation-urllib/setup.py | 2 -- .../opentelemetry-instrumentation-urllib3/setup.py | 2 -- .../opentelemetry-instrumentation-wsgi/setup.py | 2 -- .../src/opentelemetry/instrumentation/wsgi/package.py | 2 +- .../src/opentelemetry/instrumentation/bootstrap.py | 11 +++++++++++ templates/instrumentation_setup.py.txt | 2 +- 35 files changed, 13 insertions(+), 66 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/setup.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/setup.py index 097a75fd74..824db2983e 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/setup.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-aiopg/setup.py b/instrumentation/opentelemetry-instrumentation-aiopg/setup.py index fa8f48952c..35b33958ef 100644 --- a/instrumentation/opentelemetry-instrumentation-aiopg/setup.py +++ b/instrumentation/opentelemetry-instrumentation-aiopg/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-asgi/setup.py b/instrumentation/opentelemetry-instrumentation-asgi/setup.py index cd0c883524..f89c65f0a2 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/setup.py +++ b/instrumentation/opentelemetry-instrumentation-asgi/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-asyncpg/setup.py b/instrumentation/opentelemetry-instrumentation-asyncpg/setup.py index 8ef61369cf..785d822287 100644 --- a/instrumentation/opentelemetry-instrumentation-asyncpg/setup.py +++ b/instrumentation/opentelemetry-instrumentation-asyncpg/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-boto/setup.py b/instrumentation/opentelemetry-instrumentation-boto/setup.py index 6facaa7344..0d99cc8926 100644 --- a/instrumentation/opentelemetry-instrumentation-boto/setup.py +++ b/instrumentation/opentelemetry-instrumentation-boto/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-botocore/setup.py b/instrumentation/opentelemetry-instrumentation-botocore/setup.py index fd9d7a6b0b..5317443224 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/setup.py +++ b/instrumentation/opentelemetry-instrumentation-botocore/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-celery/setup.py b/instrumentation/opentelemetry-instrumentation-celery/setup.py index dab3395e73..c4a01d212a 100644 --- a/instrumentation/opentelemetry-instrumentation-celery/setup.py +++ b/instrumentation/opentelemetry-instrumentation-celery/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-dbapi/setup.py b/instrumentation/opentelemetry-instrumentation-dbapi/setup.py index 3bc6a5c0a9..2c1d28b951 100644 --- a/instrumentation/opentelemetry-instrumentation-dbapi/setup.py +++ b/instrumentation/opentelemetry-instrumentation-dbapi/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-django/setup.py b/instrumentation/opentelemetry-instrumentation-django/setup.py index 7d1d1c64b0..5a425c0e5a 100644 --- a/instrumentation/opentelemetry-instrumentation-django/setup.py +++ b/instrumentation/opentelemetry-instrumentation-django/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/setup.py b/instrumentation/opentelemetry-instrumentation-elasticsearch/setup.py index 93972b63a9..41914e50a8 100644 --- a/instrumentation/opentelemetry-instrumentation-elasticsearch/setup.py +++ b/instrumentation/opentelemetry-instrumentation-elasticsearch/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-falcon/setup.py b/instrumentation/opentelemetry-instrumentation-falcon/setup.py index 31a6510979..ca770e9260 100644 --- a/instrumentation/opentelemetry-instrumentation-falcon/setup.py +++ b/instrumentation/opentelemetry-instrumentation-falcon/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-fastapi/setup.py b/instrumentation/opentelemetry-instrumentation-fastapi/setup.py index 2e82525512..a56f7434a0 100644 --- a/instrumentation/opentelemetry-instrumentation-fastapi/setup.py +++ b/instrumentation/opentelemetry-instrumentation-fastapi/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-flask/setup.py b/instrumentation/opentelemetry-instrumentation-flask/setup.py index eb49ed319c..251d905739 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/setup.py +++ b/instrumentation/opentelemetry-instrumentation-flask/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-grpc/setup.py b/instrumentation/opentelemetry-instrumentation-grpc/setup.py index 564b2bc741..aaac587baa 100644 --- a/instrumentation/opentelemetry-instrumentation-grpc/setup.py +++ b/instrumentation/opentelemetry-instrumentation-grpc/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-jinja2/setup.py b/instrumentation/opentelemetry-instrumentation-jinja2/setup.py index f7fec88457..f89c545429 100644 --- a/instrumentation/opentelemetry-instrumentation-jinja2/setup.py +++ b/instrumentation/opentelemetry-instrumentation-jinja2/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-logging/setup.py b/instrumentation/opentelemetry-instrumentation-logging/setup.py index 51e00e8268..38f3826d33 100644 --- a/instrumentation/opentelemetry-instrumentation-logging/setup.py +++ b/instrumentation/opentelemetry-instrumentation-logging/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-mysql/setup.py b/instrumentation/opentelemetry-instrumentation-mysql/setup.py index 50326baefa..ba396f9ffb 100644 --- a/instrumentation/opentelemetry-instrumentation-mysql/setup.py +++ b/instrumentation/opentelemetry-instrumentation-mysql/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-psycopg2/setup.py b/instrumentation/opentelemetry-instrumentation-psycopg2/setup.py index e59caef689..077f70345b 100644 --- a/instrumentation/opentelemetry-instrumentation-psycopg2/setup.py +++ b/instrumentation/opentelemetry-instrumentation-psycopg2/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-pymemcache/setup.py b/instrumentation/opentelemetry-instrumentation-pymemcache/setup.py index 9173c05b9b..2964e4c7a6 100644 --- a/instrumentation/opentelemetry-instrumentation-pymemcache/setup.py +++ b/instrumentation/opentelemetry-instrumentation-pymemcache/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-pymongo/setup.py b/instrumentation/opentelemetry-instrumentation-pymongo/setup.py index 49c97a0f45..23ea29503b 100644 --- a/instrumentation/opentelemetry-instrumentation-pymongo/setup.py +++ b/instrumentation/opentelemetry-instrumentation-pymongo/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-pymysql/setup.py b/instrumentation/opentelemetry-instrumentation-pymysql/setup.py index fed1e1e99c..2da219349a 100644 --- a/instrumentation/opentelemetry-instrumentation-pymysql/setup.py +++ b/instrumentation/opentelemetry-instrumentation-pymysql/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-pyramid/setup.py b/instrumentation/opentelemetry-instrumentation-pyramid/setup.py index 6e4176250b..20790df8c1 100644 --- a/instrumentation/opentelemetry-instrumentation-pyramid/setup.py +++ b/instrumentation/opentelemetry-instrumentation-pyramid/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-redis/setup.py b/instrumentation/opentelemetry-instrumentation-redis/setup.py index 4a17a8c815..bc90b25aa8 100644 --- a/instrumentation/opentelemetry-instrumentation-redis/setup.py +++ b/instrumentation/opentelemetry-instrumentation-redis/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-requests/setup.py b/instrumentation/opentelemetry-instrumentation-requests/setup.py index bf5c455688..c8e36d3b1f 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/setup.py +++ b/instrumentation/opentelemetry-instrumentation-requests/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-sklearn/setup.py b/instrumentation/opentelemetry-instrumentation-sklearn/setup.py index 003d9736a6..8aec671b8d 100644 --- a/instrumentation/opentelemetry-instrumentation-sklearn/setup.py +++ b/instrumentation/opentelemetry-instrumentation-sklearn/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/setup.py b/instrumentation/opentelemetry-instrumentation-sqlalchemy/setup.py index e79859c22a..90170b54a7 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlalchemy/setup.py +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-sqlite3/setup.py b/instrumentation/opentelemetry-instrumentation-sqlite3/setup.py index 4e3218495a..1ea62e9c0a 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlite3/setup.py +++ b/instrumentation/opentelemetry-instrumentation-sqlite3/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-starlette/setup.py b/instrumentation/opentelemetry-instrumentation-starlette/setup.py index a256b63c45..f7c28941c1 100644 --- a/instrumentation/opentelemetry-instrumentation-starlette/setup.py +++ b/instrumentation/opentelemetry-instrumentation-starlette/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-tornado/setup.py b/instrumentation/opentelemetry-instrumentation-tornado/setup.py index cd4bb7484c..018b4773b3 100644 --- a/instrumentation/opentelemetry-instrumentation-tornado/setup.py +++ b/instrumentation/opentelemetry-instrumentation-tornado/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-urllib/setup.py b/instrumentation/opentelemetry-instrumentation-urllib/setup.py index dcd501aa41..bebd64a09f 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/setup.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/setup.py b/instrumentation/opentelemetry-instrumentation-urllib3/setup.py index fca33a5982..99c2c04396 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/setup.py +++ b/instrumentation/opentelemetry-instrumentation-urllib3/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-wsgi/setup.py b/instrumentation/opentelemetry-instrumentation-wsgi/setup.py index 3caa6fccd1..2ee7cfbfcf 100644 --- a/instrumentation/opentelemetry-instrumentation-wsgi/setup.py +++ b/instrumentation/opentelemetry-instrumentation-wsgi/setup.py @@ -17,8 +17,6 @@ # RUN `python scripts/generate_setup.py` TO REGENERATE. -import distutils.cmd -import json import os import distutils.cmd import json diff --git a/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/package.py b/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/package.py index 7a66a17a93..fe3d56c0e3 100644 --- a/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/package.py +++ b/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/package.py @@ -13,4 +13,4 @@ # limitations under the License. -_instruments = tuple() +_instruments = ("wsgiref ~= 0.1.2",) diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py index e691f0c360..20d1cc4361 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py @@ -105,6 +105,17 @@ def _is_installed(req): return False return True + try: + pkg_resources.get_distribution(req) + except pkg_resources.DistributionNotFound: + return False + except pkg_resources.VersionConflict as exc: + logger.warning( + "instrumentation for package %s is available but version %s is installed. Skipping." + % (exc.req, exc.dist.as_requirement()) + ) + return False + return True def _find_installed_libraries(): libs = default_instrumentations[:] diff --git a/templates/instrumentation_setup.py.txt b/templates/instrumentation_setup.py.txt index 69fa7a1e4a..7d8ef523f5 100644 --- a/templates/instrumentation_setup.py.txt +++ b/templates/instrumentation_setup.py.txt @@ -81,7 +81,7 @@ class JSONMetadataCommand(distutils.cmd.Command): setuptools.setup( - cmdclass={'meta': JSONMetadataCommand}, + cmdclass={'meta': JSONMetadataCommand}, version=PACKAGE_INFO["__version__"], extras_require=extras_require ) \ No newline at end of file