Skip to content

Commit c2f031d

Browse files
authored
Merge branch 'main' into bug-3352/fix-transient-ci-git-errors
2 parents cb60d27 + af17965 commit c2f031d

File tree

30 files changed

+1675
-329
lines changed

30 files changed

+1675
-329
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
1212
## Unreleased
1313

14+
### Fixed
15+
16+
- `opentelemetry-instrumentation` Fix client address is set to server address in new semconv
17+
([#3354](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3354))
18+
1419
## Version 1.31.0/0.52b0 (2025-03-12)
1520

1621
### Added
@@ -36,7 +41,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3641
- Loosen `opentelemetry-instrumentation-starlette[instruments]` specifier
3742
([#3304](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3304))
3843

39-
4044
### Fixed
4145

4246
- `opentelemetry-instrumentation-redis` Add missing entry in doc string for `def _instrument`
@@ -114,7 +118,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
114118
### Breaking changes
115119

116120
- `opentelemetry-exporter-prometheus-remote-write` updated protobuf required version from 4.21 to 5.26 and regenerated protobufs
117-
([#3219](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3219))
121+
([#3219](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3219))
118122
- `opentelemetry-instrumentation-sqlalchemy` including sqlcomment in `db.statement` span attribute value is now opt-in
119123
([#3112](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3112))
120124
- `opentelemetry-instrumentation-dbapi` including sqlcomment in `db.statement` span attribute value is now opt-in

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
- Restructure tests to keep in line with repository conventions ([#3344](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3344))
11+
1012
## Version 0.1b0 (2025-03-05)
1113

1214
- Add support for async and streaming.

instrumentation-genai/opentelemetry-instrumentation-google-genai/TODOS.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Here are some TODO items required to achieve stability for this package:
1313
- Additional cleanup/improvement tasks such as:
1414
- Adoption of 'wrapt' instead of 'functools.wraps'
1515
- Bolstering test coverage
16-
- Migrate tests to use VCR.py
1716

1817
## Future
1918

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright The OpenTelemetry Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import google.auth.credentials
16+
17+
18+
class FakeCredentials(google.auth.credentials.AnonymousCredentials):
19+
def refresh(self, request):
20+
pass

instrumentation-genai/opentelemetry-instrumentation-google-genai/tests/common/base.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,22 @@
1717

1818
import google.genai
1919

20+
from .auth import FakeCredentials
2021
from .instrumentation_context import InstrumentationContext
2122
from .otel_mocker import OTelMocker
22-
from .requests_mocker import RequestsMocker
23-
24-
25-
class _FakeCredentials(google.auth.credentials.AnonymousCredentials):
26-
def refresh(self, request):
27-
pass
2823

2924

3025
class TestCase(unittest.TestCase):
3126
def setUp(self):
3227
self._otel = OTelMocker()
3328
self._otel.install()
34-
self._requests = RequestsMocker()
35-
self._requests.install()
3629
self._instrumentation_context = None
3730
self._api_key = "test-api-key"
3831
self._project = "test-project"
3932
self._location = "test-location"
4033
self._client = None
4134
self._uses_vertex = False
42-
self._credentials = _FakeCredentials()
35+
self._credentials = FakeCredentials()
4336

4437
def _lazy_init(self):
4538
self._instrumentation_context = InstrumentationContext()
@@ -51,17 +44,22 @@ def client(self):
5144
self._client = self._create_client()
5245
return self._client
5346

54-
@property
55-
def requests(self):
56-
return self._requests
57-
5847
@property
5948
def otel(self):
6049
return self._otel
6150

6251
def set_use_vertex(self, use_vertex):
6352
self._uses_vertex = use_vertex
6453

54+
def reset_client(self):
55+
self._client = None
56+
57+
def reset_instrumentation(self):
58+
if self._instrumentation_context is None:
59+
return
60+
self._instrumentation_context.uninstall()
61+
self._instrumentation_context = None
62+
6563
def _create_client(self):
6664
self._lazy_init()
6765
if self._uses_vertex:
@@ -72,10 +70,9 @@ def _create_client(self):
7270
location=self._location,
7371
credentials=self._credentials,
7472
)
75-
return google.genai.Client(api_key=self._api_key)
73+
return google.genai.Client(vertexai=False, api_key=self._api_key)
7674

7775
def tearDown(self):
7876
if self._instrumentation_context is not None:
7977
self._instrumentation_context.uninstall()
80-
self._requests.uninstall()
8178
self._otel.uninstall()

instrumentation-genai/opentelemetry-instrumentation-google-genai/tests/common/requests_mocker.py

Lines changed: 0 additions & 238 deletions
This file was deleted.

0 commit comments

Comments
 (0)