Skip to content

Commit 23e6c7e

Browse files
committed
Several fixes
1 parent 643db19 commit 23e6c7e

File tree

12 files changed

+22
-102
lines changed

12 files changed

+22
-102
lines changed

opentelemetry-api/setup.py

-7
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@
4040
"Programming Language :: Python :: 3.6",
4141
"Programming Language :: Python :: 3.7",
4242
],
43-
entry_points={
44-
"console_scripts": [
45-
"opentelemetry-auto-instrument = "
46-
"opentelemetry.auto_instrument.auto_instrument:run"
47-
],
48-
"opentelemetry_patcher": [],
49-
},
5043
description="OpenTelemetry Python API",
5144
include_package_data=True,
5245
long_description=open("README.rst").read(),

opentelemetry-api/src/opentelemetry/patcher/__init__.py

-78
This file was deleted.

opentelemetry-auto-instrumentation/setup.py

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020, OpenTelemetry Authors
1+
# Copyright 2019, OpenTelemetry Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
1818

1919
BASE_DIR = os.path.dirname(__file__)
2020
VERSION_FILENAME = os.path.join(
21-
BASE_DIR, "src", "opentelemetry", , "version.py"
21+
BASE_DIR, "src", "opentelemetry", "auto_instrumentation", "version.py"
2222
)
2323
PACKAGE_INFO = {}
2424
with open(VERSION_FILENAME) as f:
@@ -40,23 +40,16 @@
4040
"Programming Language :: Python :: 3.6",
4141
"Programming Language :: Python :: 3.7",
4242
],
43-
entry_points={
44-
"console_scripts": [
45-
"opentelemetry-auto-instrument = "
46-
"opentelemetry.auto_instrument.auto_instrument:run"
47-
],
48-
"opentelemetry_patcher": [],
49-
},
5043
description="OpenTelemetry Python Auto Instrumentation",
5144
include_package_data=True,
5245
long_description=open("README.rst").read(),
5346
long_description_content_type="text/x-rst",
54-
install_requires=["typing; python_version<'3.5'"],
47+
install_requires=["opentelemetry-api==0.4.dev0"],
5548
extras_require={},
5649
license="Apache-2.0",
5750
package_dir={"": "src"},
5851
packages=setuptools.find_namespace_packages(
59-
where="src", include="opentelemetry.*"
52+
where="src", include="opentelemetry.auto_instrumentation.*"
6053
),
6154
url=(
6255
"https://github.com/open-telemetry/opentelemetry-python"

opentelemetry-auto-instrumentation/src/opentelemetry/auto_instrumentation/auto_instrument.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ def run() -> None:
2525
bootstrap_dir = dirname(__file__)
2626
python_path = environ.get("PYTHONPATH", None)
2727

28-
# Add our bootstrap directory to the head of $PYTHONPATH to ensure
29-
# it is loaded before program code
30-
if python_path is not None:
31-
environ["PYTHONPATH"] = join(bootstrap_dir, python_path)
32-
else:
28+
if python_path is None:
3329
environ["PYTHONPATH"] = bootstrap_dir
30+
else:
31+
environ["PYTHONPATH"] = join(bootstrap_dir, python_path)
3432

3533
python3 = which(argv[1])
3634
execl(python3, python3, *argv[2:]) # type: ignore

opentelemetry-auto-instrumentation/tests/patcher/__init__.py opentelemetry-auto-instrumentation/tests/test_auto_instrumentation.py

+14
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,17 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
# type: ignore
15+
16+
from unittest import TestCase
17+
from unittest.mock import patch
18+
import sys
19+
20+
from opentelemetry.auto_instrumentation.auto_instrument import run
21+
22+
23+
class TestAutoInstrumentation(TestCase):
24+
def test_auto_instrumentation(self):
25+
26+
with patch.object(sys, "argv", ["python3", "hello.py"]):
27+
auto_instrument.run()

opentelemetry-auto-instrumentation/tests/patcher/test_patcher.py opentelemetry-auto-instrumentation/tests/test_patcher.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from logging import WARNING
1717
from unittest import TestCase
1818

19-
from opentelemetry.patcher import BasePatcher
19+
from opentelemetry.auto_instrumentation.patcher import BasePatcher
2020

2121

2222
class TestPatcher(TestCase):

0 commit comments

Comments
 (0)