diff --git a/instrumentation/opentelemetry-instrumentation-openai/pyproject.toml b/instrumentation/opentelemetry-instrumentation-openai/pyproject.toml index d54858623a..20ae327af9 100644 --- a/instrumentation/opentelemetry-instrumentation-openai/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-openai/pyproject.toml @@ -38,7 +38,7 @@ instruments = [ ] [project.entry-points.opentelemetry_instrumentor] -openai = "opentelemetry.instrumentation.openai:OpenAIInstrumentor" +openai = "opentelemetry.instrumentation.openai.v2:OpenAIInstrumentor" [project.urls] Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-openai" diff --git a/instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/__init__.py b/instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/v2/__init__.py similarity index 96% rename from instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/__init__.py rename to instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/v2/__init__.py index 86e826146e..410f92cc17 100644 --- a/instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/v2/__init__.py @@ -46,7 +46,7 @@ from wrapt import wrap_function_wrapper from opentelemetry.instrumentation.instrumentor import BaseInstrumentor -from opentelemetry.instrumentation.openai.package import _instruments +from opentelemetry.instrumentation.openai.v2.package import _instruments from opentelemetry.trace import get_tracer from .patch import chat_completions_create diff --git a/instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/package.py b/instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/v2/package.py similarity index 100% rename from instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/package.py rename to instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/v2/package.py diff --git a/instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py b/instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/v2/patch.py similarity index 100% rename from instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/patch.py rename to instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/v2/patch.py diff --git a/instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/span_attributes.py b/instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/v2/span_attributes.py similarity index 100% rename from instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/span_attributes.py rename to instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/v2/span_attributes.py diff --git a/instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/utils.py b/instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/v2/utils.py similarity index 100% rename from instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/utils.py rename to instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/v2/utils.py diff --git a/instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/version.py b/instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/v2/version.py similarity index 100% rename from instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/version.py rename to instrumentation/opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/v2/version.py diff --git a/instrumentation/opentelemetry-instrumentation-openai/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-openai/test-requirements.txt index 6b3d9ef39d..bca6bfbd0e 100644 --- a/instrumentation/opentelemetry-instrumentation-openai/test-requirements.txt +++ b/instrumentation/opentelemetry-instrumentation-openai/test-requirements.txt @@ -3,6 +3,8 @@ Deprecated==1.2.14 importlib-metadata==6.11.0 packaging==24.0 pytest==7.4.4 +pytest-vcr==1.0.2 wrapt==1.16.0 -# -e opentelemetry-instrumentation -# -e instrumentation/opentelemetry-instrumentation-openai + +-e opentelemetry-instrumentation +-e instrumentation/opentelemetry-instrumentation-openai diff --git a/tox.ini b/tox.ini index 600929a6ec..02066afc19 100644 --- a/tox.ini +++ b/tox.ini @@ -6,6 +6,11 @@ envlist = ; Environments are organized by individual package, allowing ; for specifying supported Python versions per package. + ; instrumentation-openai + py3{8,9,10,11,12}-test-instrumentation-openai + pypy3-test-instrumentation-openai + lint-instrumentation-openai + ; opentelemetry-resource-detector-container py3{8,9,10,11,12}-test-resource-detector-container pypy3-test-resource-detector-container @@ -399,6 +404,12 @@ commands_pre = opentelemetry-instrumentation: pip install opentelemetry-test-utils@{env:CORE_REPO}\#egg=opentelemetry-test-utils&subdirectory=tests/opentelemetry-test-utils opentelemetry-instrumentation: pip install -r {toxinidir}/opentelemetry-instrumentation/test-requirements.txt + openai: pip install opentelemetry-api@{env:CORE_REPO}\#egg=opentelemetry-api&subdirectory=opentelemetry-api + openai: pip install opentelemetry-semantic-conventions@{env:CORE_REPO}\#egg=opentelemetry-semantic-conventions&subdirectory=opentelemetry-semantic-conventions + openai: pip install opentelemetry-sdk@{env:CORE_REPO}\#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk + openai: pip install opentelemetry-test-utils@{env:CORE_REPO}\#egg=opentelemetry-test-utils&subdirectory=tests/opentelemetry-test-utils + openai: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-openai/test-requirements.txt + distro: pip install opentelemetry-api@{env:CORE_REPO}\#egg=opentelemetry-api&subdirectory=opentelemetry-api distro: pip install opentelemetry-semantic-conventions@{env:CORE_REPO}\#egg=opentelemetry-semantic-conventions&subdirectory=opentelemetry-semantic-conventions distro: pip install opentelemetry-sdk@{env:CORE_REPO}\#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk @@ -445,6 +456,11 @@ commands_pre = kafka-pythonng: pip install opentelemetry-sdk@{env:CORE_REPO}\#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk kafka-pythonng: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-kafka-python/test-requirements-ng.txt + openai: pip install opentelemetry-api@{env:CORE_REPO}\#egg=opentelemetry-api&subdirectory=opentelemetry-api + openai: pip install opentelemetry-sdk@{env:CORE_REPO}\#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk + openai: pip install opentelemetry-semantic-conventions@{env:CORE_REPO}\#egg=opentelemetry-semantic-conventions&subdirectory=opentelemetry-semantic-conventions + openai: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-openai/test-requirements.txt + confluent-kafka: pip install opentelemetry-api@{env:CORE_REPO}\#egg=opentelemetry-api&subdirectory=opentelemetry-api confluent-kafka: pip install opentelemetry-semantic-conventions@{env:CORE_REPO}\#egg=opentelemetry-semantic-conventions&subdirectory=opentelemetry-semantic-conventions confluent-kafka: pip install opentelemetry-sdk@{env:CORE_REPO}\#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk