Skip to content

Commit 0e1c38f

Browse files
authored
Merge branch 'open-telemetry:main' into fix/1477
2 parents 44d9f8d + 6114b60 commit 0e1c38f

File tree

6 files changed

+41
-20
lines changed

6 files changed

+41
-20
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2727
([#3302](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3302))
2828
- `opentelemetry-instrumentation` make it simpler to initialize auto-instrumentation programmatically
2929
([#3273](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3273))
30+
- Add `opentelemetry-instrumentation-vertexai>=2.0b0` to `opentelemetry-bootstrap`
31+
([#3307](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3307))
32+
3033

3134
### Fixed
3235

instrumentation-genai/opentelemetry-instrumentation-vertexai/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10-
## Version 2.0b0 (2025-02-21)
10+
## Version 2.0b0 (2025-02-24)
1111

1212
- Added Vertex AI spans for request parameters
1313
([#3192](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3192))

instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py

+15-7
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,29 @@
2222
2323
.. code:: python
2424
25+
import asyncio
2526
import aiohttp
2627
from opentelemetry.instrumentation.aiohttp_client import create_trace_config
2728
import yarl
2829
2930
def strip_query_params(url: yarl.URL) -> str:
3031
return str(url.with_query(None))
3132
32-
async with aiohttp.ClientSession(trace_configs=[create_trace_config(
33+
async def get(url):
34+
async with aiohttp.ClientSession(trace_configs=[create_trace_config(
3335
# Remove all query params from the URL attribute on the span.
3436
url_filter=strip_query_params,
35-
)]) as session:
36-
async with session.get(url) as response:
37-
await response.text()
37+
)]) as session:
38+
async with session.get(url) as response:
39+
await response.text()
40+
41+
asyncio.run(get("https://example.com"))
3842
3943
Instrumenting all client sessions:
4044
4145
.. code:: python
4246
47+
import asyncio
4348
import aiohttp
4449
from opentelemetry.instrumentation.aiohttp_client import (
4550
AioHttpClientInstrumentor
@@ -49,9 +54,12 @@ def strip_query_params(url: yarl.URL) -> str:
4954
AioHttpClientInstrumentor().instrument()
5055
5156
# Create a session and make an HTTP get request
52-
async with aiohttp.ClientSession() as session:
53-
async with session.get(url) as response:
54-
await response.text()
57+
async def get(url):
58+
async with aiohttp.ClientSession() as session:
59+
async with session.get(url) as response:
60+
await response.text()
61+
62+
asyncio.run(get("https://example.com"))
5563
5664
Configuration
5765
-------------

opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
"library": "openai >= 1.26.0",
2121
"instrumentation": "opentelemetry-instrumentation-openai-v2",
2222
},
23+
{
24+
"library": "google-cloud-aiplatform >= 1.64",
25+
"instrumentation": "opentelemetry-instrumentation-vertexai>=2.0b0",
26+
},
2327
{
2428
"library": "aio_pika >= 7.2.0, < 10.0.0",
2529
"instrumentation": "opentelemetry-instrumentation-aio-pika==0.52b0.dev",

scripts/generate_instrumentation_bootstrap.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,22 @@
6464
# development. This filter will get removed once it is further along in its
6565
# development lifecycle and ready to be included by default.
6666
"opentelemetry-instrumentation-google-genai",
67-
"opentelemetry-instrumentation-vertexai", # not released yet
6867
]
6968

70-
# We should not put any version limit for instrumentations that are released independently
71-
unversioned_packages = [
72-
"opentelemetry-instrumentation-openai-v2",
73-
"opentelemetry-instrumentation-vertexai",
74-
"opentelemetry-instrumentation-google-genai",
75-
]
69+
# Static version specifiers for instrumentations that are released independently
70+
independent_packages = {
71+
"opentelemetry-instrumentation-openai-v2": "",
72+
"opentelemetry-instrumentation-vertexai": ">=2.0b0",
73+
"opentelemetry-instrumentation-google-genai": "",
74+
}
7675

7776

7877
def main():
7978
# pylint: disable=no-member
8079
default_instrumentations = ast.List(elts=[])
8180
libraries = ast.List(elts=[])
8281
for pkg in get_instrumentation_packages(
83-
unversioned_packages=unversioned_packages
82+
independent_packages=independent_packages
8483
):
8584
pkg_name = pkg.get("name")
8685
if pkg_name in packages_to_exclude:

scripts/otel_packaging.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from __future__ import annotations
16+
1517
import os
1618
import subprocess
1719
from subprocess import CalledProcessError
@@ -24,8 +26,10 @@
2426
genai_instrumentations_path = os.path.join(root_path, "instrumentation-genai")
2527

2628

27-
def get_instrumentation_packages(unversioned_packages=None):
28-
unversioned_packages = unversioned_packages or []
29+
def get_instrumentation_packages(
30+
independent_packages: dict[str, str] | None = None,
31+
):
32+
independent_packages = independent_packages or {}
2933
pkg_paths = []
3034
for pkg in os.listdir(instrumentations_path):
3135
pkg_path = os.path.join(instrumentations_path, pkg)
@@ -63,8 +67,11 @@ def get_instrumentation_packages(unversioned_packages=None):
6367
"instruments"
6468
],
6569
}
66-
if instrumentation["name"] in unversioned_packages:
67-
instrumentation["requirement"] = instrumentation["name"]
70+
if instrumentation["name"] in independent_packages:
71+
specifier = independent_packages[instrumentation["name"]]
72+
instrumentation["requirement"] = (
73+
f"{instrumentation['name']}{specifier}"
74+
)
6875
else:
6976
instrumentation["requirement"] = "==".join(
7077
(

0 commit comments

Comments
 (0)