diff --git a/.github/workflows/core_contrib_test_0.yml b/.github/workflows/core_contrib_test_0.yml index fa7f0d668b..83584cb4aa 100644 --- a/.github/workflows/core_contrib_test_0.yml +++ b/.github/workflows/core_contrib_test_0.yml @@ -143,66 +143,6 @@ jobs: - name: Run tests run: tox -e py39-test-instrumentation-vertexai-latest -- -ra - py39-test-instrumentation-google-genai-oldest: - name: instrumentation-google-genai-oldest - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python-contrib - ref: ${{ env.CONTRIB_REPO_SHA }} - - - name: Checkout core repo @ SHA - ${{ env.CORE_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python - ref: ${{ env.CORE_REPO_SHA }} - path: opentelemetry-python - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - architecture: "x64" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py39-test-instrumentation-google-genai-oldest -- -ra - - py39-test-instrumentation-google-genai-latest: - name: instrumentation-google-genai-latest - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python-contrib - ref: ${{ env.CONTRIB_REPO_SHA }} - - - name: Checkout core repo @ SHA - ${{ env.CORE_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python - ref: ${{ env.CORE_REPO_SHA }} - path: opentelemetry-python - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - architecture: "x64" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py39-test-instrumentation-google-genai-latest -- -ra - py39-test-instrumentation-anthropic-oldest: name: instrumentation-anthropic-oldest runs-on: ubuntu-latest diff --git a/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/lint.yml.j2 b/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/lint.yml.j2 index 87fc1a0a0f..a9e810013a 100644 --- a/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/lint.yml.j2 +++ b/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/lint.yml.j2 @@ -25,8 +25,8 @@ env: CORE_REPO_SHA: {% raw %}${{ github.event_name == 'pull_request' && ( contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref || contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref || - 'main' - ) || 'main' }}{% endraw %} + 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' + ) || 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' }}{% endraw %} CONTRIB_REPO_SHA: main PIP_EXISTS_ACTION: w diff --git a/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2 b/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2 index 4bc5f38e87..eae4c15bfd 100644 --- a/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2 +++ b/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2 @@ -25,8 +25,8 @@ env: CORE_REPO_SHA: {% raw %}${{ github.event_name == 'pull_request' && ( contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref || contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref || - 'main' - ) || 'main' }}{% endraw %} + 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' + ) || 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' }}{% endraw %} CONTRIB_REPO_SHA: main PIP_EXISTS_ACTION: w diff --git a/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/test.yml.j2 b/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/test.yml.j2 index b8f45b840f..f84964bcf6 100644 --- a/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/test.yml.j2 +++ b/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/test.yml.j2 @@ -25,8 +25,8 @@ env: CORE_REPO_SHA: {% raw %}${{ github.event_name == 'pull_request' && ( contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref || contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref || - 'main' - ) || 'main' }}{% endraw %} + 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' + ) || 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' }}{% endraw %} CONTRIB_REPO_SHA: main PIP_EXISTS_ACTION: w diff --git a/.github/workflows/lint_0.yml b/.github/workflows/lint_0.yml index cb7b726df9..fb325950b5 100644 --- a/.github/workflows/lint_0.yml +++ b/.github/workflows/lint_0.yml @@ -25,8 +25,8 @@ env: CORE_REPO_SHA: ${{ github.event_name == 'pull_request' && ( contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref || contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref || - 'main' - ) || 'main' }} + 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' + ) || 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' }} CONTRIB_REPO_SHA: main PIP_EXISTS_ACTION: w diff --git a/.github/workflows/misc_0.yml b/.github/workflows/misc_0.yml index 18a1a499a3..765018b938 100644 --- a/.github/workflows/misc_0.yml +++ b/.github/workflows/misc_0.yml @@ -25,8 +25,8 @@ env: CORE_REPO_SHA: ${{ github.event_name == 'pull_request' && ( contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref || contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref || - 'main' - ) || 'main' }} + 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' + ) || 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' }} CONTRIB_REPO_SHA: main PIP_EXISTS_ACTION: w diff --git a/.github/workflows/test_0.yml b/.github/workflows/test_0.yml index f057dbc7b9..89d3f3d413 100644 --- a/.github/workflows/test_0.yml +++ b/.github/workflows/test_0.yml @@ -25,8 +25,8 @@ env: CORE_REPO_SHA: ${{ github.event_name == 'pull_request' && ( contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref || contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref || - 'main' - ) || 'main' }} + 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' + ) || 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' }} CONTRIB_REPO_SHA: main PIP_EXISTS_ACTION: w @@ -716,44 +716,6 @@ jobs: - name: Run tests run: tox -e py314-test-instrumentation-vertexai-latest -- -ra - py39-test-instrumentation-google-genai-oldest_ubuntu-latest: - name: instrumentation-google-genai-oldest 3.9 Ubuntu - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py39-test-instrumentation-google-genai-oldest -- -ra - - py39-test-instrumentation-google-genai-latest_ubuntu-latest: - name: instrumentation-google-genai-latest 3.9 Ubuntu - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py39-test-instrumentation-google-genai-latest -- -ra - py310-test-instrumentation-google-genai-oldest_ubuntu-latest: name: instrumentation-google-genai-oldest 3.10 Ubuntu runs-on: ubuntu-latest @@ -4781,3 +4743,41 @@ jobs: - name: Run tests run: tox -e py314-test-instrumentation-fastapi -- -ra + + pypy3-test-instrumentation-fastapi_ubuntu-latest: + name: instrumentation-fastapi pypy-3.9 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python pypy-3.9 + uses: actions/setup-python@v5 + with: + python-version: "pypy-3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e pypy3-test-instrumentation-fastapi -- -ra + + py39-test-instrumentation-flask-0_ubuntu-latest: + name: instrumentation-flask-0 3.9 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-instrumentation-flask-0 -- -ra diff --git a/.github/workflows/test_1.yml b/.github/workflows/test_1.yml index 3da7168646..7a376f8f59 100644 --- a/.github/workflows/test_1.yml +++ b/.github/workflows/test_1.yml @@ -25,51 +25,13 @@ env: CORE_REPO_SHA: ${{ github.event_name == 'pull_request' && ( contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref || contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref || - 'main' - ) || 'main' }} + 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' + ) || 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' }} CONTRIB_REPO_SHA: main PIP_EXISTS_ACTION: w jobs: - pypy3-test-instrumentation-fastapi_ubuntu-latest: - name: instrumentation-fastapi pypy-3.9 Ubuntu - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python pypy-3.9 - uses: actions/setup-python@v5 - with: - python-version: "pypy-3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e pypy3-test-instrumentation-fastapi -- -ra - - py39-test-instrumentation-flask-0_ubuntu-latest: - name: instrumentation-flask-0 3.9 Ubuntu - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py39-test-instrumentation-flask-0 -- -ra - py39-test-instrumentation-flask-1_ubuntu-latest: name: instrumentation-flask-1 3.9 Ubuntu runs-on: ubuntu-latest @@ -4781,3 +4743,41 @@ jobs: - name: Run tests run: tox -e py311-test-instrumentation-redis -- -ra + + py312-test-instrumentation-redis_ubuntu-latest: + name: instrumentation-redis 3.12 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-instrumentation-redis -- -ra + + py313-test-instrumentation-redis_ubuntu-latest: + name: instrumentation-redis 3.13 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-instrumentation-redis -- -ra diff --git a/.github/workflows/test_2.yml b/.github/workflows/test_2.yml index bdc6cefdae..9a982c2b93 100644 --- a/.github/workflows/test_2.yml +++ b/.github/workflows/test_2.yml @@ -25,51 +25,13 @@ env: CORE_REPO_SHA: ${{ github.event_name == 'pull_request' && ( contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref || contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref || - 'main' - ) || 'main' }} + 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' + ) || 'f32b684a1ccd6d5eb658ec0b45bf18928ea430e4' }} CONTRIB_REPO_SHA: main PIP_EXISTS_ACTION: w jobs: - py312-test-instrumentation-redis_ubuntu-latest: - name: instrumentation-redis 3.12 Ubuntu - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py312-test-instrumentation-redis -- -ra - - py313-test-instrumentation-redis_ubuntu-latest: - name: instrumentation-redis 3.13 Ubuntu - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.13 - uses: actions/setup-python@v5 - with: - python-version: "3.13" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py313-test-instrumentation-redis -- -ra - py314-test-instrumentation-redis_ubuntu-latest: name: instrumentation-redis 3.14 Ubuntu runs-on: ubuntu-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 49647161e1..03872e8419 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,3 +20,4 @@ repos: - id: rstcheck additional_dependencies: ['rstcheck[sphinx]'] args: ["--report-level", "warning"] + exclude: ^_template/ diff --git a/instrumentation-genai/README.md b/instrumentation-genai/README.md index a6498da6a5..86e99e7a48 100644 --- a/instrumentation-genai/README.md +++ b/instrumentation-genai/README.md @@ -3,7 +3,7 @@ | --------------- | ------------------ | --------------- | -------------- | | [opentelemetry-instrumentation-anthropic](./opentelemetry-instrumentation-anthropic) | anthropic >= 0.16.0 | No | development | [opentelemetry-instrumentation-claude-agent-sdk](./opentelemetry-instrumentation-claude-agent-sdk) | claude-agent-sdk >= 0.1.14 | No | development -| [opentelemetry-instrumentation-google-genai](./opentelemetry-instrumentation-google-genai) | google-genai >= 1.0.0 | No | development +| [opentelemetry-instrumentation-google-genai](./opentelemetry-instrumentation-google-genai) | google-genai >= 1.0.0, <3 | No | development | [opentelemetry-instrumentation-langchain](./opentelemetry-instrumentation-langchain) | langchain >= 0.3.21 | No | development | [opentelemetry-instrumentation-openai-agents-v2](./opentelemetry-instrumentation-openai-agents-v2) | openai-agents >= 0.3.3 | No | development | [opentelemetry-instrumentation-openai-v2](./opentelemetry-instrumentation-openai-v2) | openai >= 1.26.0 | Yes | development diff --git a/instrumentation-genai/opentelemetry-instrumentation-google-genai/CHANGELOG.md b/instrumentation-genai/opentelemetry-instrumentation-google-genai/CHANGELOG.md index a0a18aa494..c0130ee1a1 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-google-genai/CHANGELOG.md +++ b/instrumentation-genai/opentelemetry-instrumentation-google-genai/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +- Relax version constraint of `google-genai` to allow v2 of that library to be used with the instrumentation library. + ## Version 0.7b0 (2026-02-20) - Fix bug in how tokens are counted when using the streaming `generateContent` method. ([#4152](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4152)). - Add `gen_ai.tool.definitions` attribute to `gen_ai.client.inference.operation.details` log event ([#4142](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4142)). diff --git a/instrumentation-genai/opentelemetry-instrumentation-google-genai/pyproject.toml b/instrumentation-genai/opentelemetry-instrumentation-google-genai/pyproject.toml index a63b28d8b4..d3a03c544f 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-google-genai/pyproject.toml +++ b/instrumentation-genai/opentelemetry-instrumentation-google-genai/pyproject.toml @@ -46,7 +46,7 @@ dependencies = [ ] [project.optional-dependencies] -instruments = ["google-genai >= 1.32.0"] +instruments = ["google-genai >= 1.0.0, <3"] [project.entry-points.opentelemetry_instrumentor] google-genai = "opentelemetry.instrumentation.google_genai:GoogleGenAiSdkInstrumentor" diff --git a/instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/instrumentor.py b/instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/instrumentor.py index 8466128c58..4bb4f145d7 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/instrumentor.py +++ b/instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/instrumentor.py @@ -44,7 +44,7 @@ def __init__( # Inherited, abstract function from 'BaseInstrumentor'. Even though 'self' is # not used in the definition, a method is required per the API contract. def instrumentation_dependencies(self) -> Collection[str]: # pylint: disable=no-self-use - return ["google-genai>=1.0.0,<2"] + return ["google-genai>=1.0.0,<3"] def _instrument(self, **kwargs: Any): tracer_provider = ( diff --git a/instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/package.py b/instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/package.py index 46a0504cce..43e2815ef7 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/package.py +++ b/instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/package.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -_instruments = ("google-genai >= 1.0.0",) +_instruments = ("google-genai >= 1.0.0, <3",) diff --git a/instrumentation-genai/opentelemetry-instrumentation-google-genai/tests/requirements.latest.txt b/instrumentation-genai/opentelemetry-instrumentation-google-genai/tests/requirements.latest.txt index 7c7d511649..73030de4d1 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-google-genai/tests/requirements.latest.txt +++ b/instrumentation-genai/opentelemetry-instrumentation-google-genai/tests/requirements.latest.txt @@ -40,8 +40,8 @@ pytest==7.4.4 pytest-asyncio==0.21.0 pytest-vcr==1.0.2 -google-auth==2.38.0 -google-genai==1.32.0 +google-auth==2.53.0 +google-genai==2.4.0 # Install locally from the folder. This path is relative to the # root directory, given invocation from "tox" at root level. diff --git a/tox.ini b/tox.ini index d1989a834b..c2c30fa4c9 100644 --- a/tox.ini +++ b/tox.ini @@ -24,7 +24,7 @@ envlist = lint-instrumentation-vertexai ; instrumentation-google-genai - py3{9,10,11,12,13,14}-test-instrumentation-google-genai-{oldest,latest} + py3{10,11,12,13,14}-test-instrumentation-google-genai-{oldest,latest} # Disabling pypy3 as shapely does not have wheels and fails to compile # pypy3-test-instrumentation-google-genai-{0,1} lint-instrumentation-google-genai @@ -775,7 +775,7 @@ allowlist_externals = setenv = ; override CORE_REPO_SHA via env variable when testing other branches/commits than main ; i.e: CORE_REPO_SHA=dde62cebffe519c35875af6d06fae053b3be65ec tox -e - CORE_REPO_SHA={env:CORE_REPO_SHA:main} + CORE_REPO_SHA={env:CORE_REPO_SHA:f32b684a1ccd6d5eb658ec0b45bf18928ea430e4} CORE_REPO=git+https://github.com/open-telemetry/opentelemetry-python.git@{env:CORE_REPO_SHA} UV_CONFIG_FILE={toxinidir}/tox-uv.toml PIP_CONSTRAINTS={toxinidir}/test-constraints.txt diff --git a/uv.lock b/uv.lock index d75bd7e73c..bb3ad8c913 100644 --- a/uv.lock +++ b/uv.lock @@ -3354,7 +3354,7 @@ instruments = [ [package.metadata] requires-dist = [ - { name = "google-genai", marker = "extra == 'instruments'", specifier = ">=1.32.0" }, + { name = "google-genai", marker = "extra == 'instruments'", specifier = ">=1.0.0,<3" }, { name = "opentelemetry-api", git = "https://github.com/open-telemetry/opentelemetry-python?subdirectory=opentelemetry-api&branch=main" }, { name = "opentelemetry-instrumentation", editable = "opentelemetry-instrumentation" }, { name = "opentelemetry-semantic-conventions", git = "https://github.com/open-telemetry/opentelemetry-python?subdirectory=opentelemetry-semantic-conventions&branch=main" },