From 69125d1b9e4ac8220639f59c523f424c4506dfaf Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Thu, 11 Apr 2024 14:50:36 +0200 Subject: [PATCH] tortoiseorm: use a list for instrumented packages Use a list to express that the tortoiseorm instrumentation targets projects that both tortoiseorm AND pydantic installed. So that tortoiseorm instrumentation is installed only if both packages are found by opentelemetry-bootstrap. --- CHANGELOG.md | 2 ++ .../pyproject.toml | 3 +-- .../src/opentelemetry/instrumentation/bootstrap_gen.py | 6 +----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a75e1537cc..085ce398fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `opentelemetry-instrumentation-asyncio` Check for __name__ attribute in the coroutine ([#2521](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2521)) - `opentelemetry-util-http` Preserve brackets around literal IPv6 hosts ([#2552](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2552)) +- `opentelemetry-instrumentation` On bootstrap don't install tortoise orm instrumentation if pydantic is found + ([#2409](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2409)) ## Version 1.24.0/0.45b0 (2024-03-28) diff --git a/instrumentation/opentelemetry-instrumentation-tortoiseorm/pyproject.toml b/instrumentation/opentelemetry-instrumentation-tortoiseorm/pyproject.toml index 62e5da5b54..ca43a44379 100644 --- a/instrumentation/opentelemetry-instrumentation-tortoiseorm/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-tortoiseorm/pyproject.toml @@ -31,8 +31,7 @@ dependencies = [ [project.optional-dependencies] instruments = [ - "tortoise-orm >= 0.17.0", - "pydantic >= 1.10.2" + ["tortoise-orm >= 0.17.0", "pydantic >= 1.10.2"], ] [project.entry-points.opentelemetry_instrumentor] diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py index 9eebd5bb38..a220a3e486 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py @@ -173,11 +173,7 @@ "instrumentation": "opentelemetry-instrumentation-tornado==0.46b0.dev", }, { - "library": "tortoise-orm >= 0.17.0", - "instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.46b0.dev", - }, - { - "library": "pydantic >= 1.10.2", + "library": ["tortoise-orm >= 0.17.0", "pydantic >= 1.10.2"], "instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.46b0.dev", }, {