Skip to content

Commit a1da2b9

Browse files
authored
Merge branch 'main' into add-claude-md
2 parents 168e916 + 5560324 commit a1da2b9

10 files changed

Lines changed: 78 additions & 106 deletions

File tree

.github/component_owners.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ components:
2525
instrumentation/opentelemetry-instrumentation-urllib3:
2626
- shalevr
2727

28-
instrumentation-genai/:
29-
- karthikscale3
30-
- lmolkova
31-
- lzchen
32-
- gyliu513
33-
- nirga
34-
- alizenhom
35-
- codefromthecrypt
36-
3728
processor/opentelemetry-processor-baggage:
3829
- codeboten
3930

@@ -45,8 +36,10 @@ components:
4536
- jj22ee
4637

4738
util/opentelemetry-util-genai:
39+
- Cirilla-zmh
4840
- DylanRussell
4941
- keith-decker
42+
- lmolkova
5043

5144
instrumentation-genai/opentelemetry-instrumentation-langchain:
5245
- zhirafovod
@@ -55,6 +48,9 @@ components:
5548
instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2:
5649
- nagkumar91
5750

51+
instrumentation-genai/opentelemetry-instrumentation-openai-v2:
52+
- lmolkova
53+
5854
instrumentation-genai/opentelemetry-instrumentation-anthropic:
5955
- vasantteja
6056
- anirudha

.github/workflows/package-prepare-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
next_version: ${{ steps.verify.outputs.next_version }}
3434
steps:
3535
- uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
3638

3739
- id: verify
3840
name: Verify prerequisites

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5959
([#4139](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4139))
6060

6161
### Fixed
62-
62+
- `opentelemetry-instrumentation-mysql`: Refactor MySQL integration test mocks to use concrete DBAPI connection attributes, reducing noisy attribute type warnings.
63+
([#4116](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4116))
6364
- `opentelemetry-instrumentation-cassandra`: Use `_instruments_any` instead of `_instruments` for driver dependencies so that having either `cassandra-driver` or `scylla-driver` installed is sufficient
6465
([#4182](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4182))
6566
- `opentelemetry-instrumentation-asyncpg`: Hydrate span attributes before creation so samplers can filter on database details

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## Unreleased
9+
10+
## Version 0.7b0 (2026-02-20)
911
- Fix bug in how tokens are counted when using the streaming `generateContent` method. ([#4152](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4152)).
1012
- 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)).
1113
- Add `gen_ai.tool_definitions` to completion hook ([#4181](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4181))

instrumentation-genai/opentelemetry-instrumentation-google-genai/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ dependencies = [
4242
"opentelemetry-api ~=1.37",
4343
"opentelemetry-instrumentation >=0.58b0, <2",
4444
"opentelemetry-semantic-conventions >=0.58b0, <2",
45-
"opentelemetry-util-genai >= 0.2b0, <0.4b0", # TODO: update version after release (https://github.com/open-telemetry/opentelemetry-python-contrib/issues/4221)
45+
"opentelemetry-util-genai >= 0.3b0, <0.4b0",
4646
]
4747

4848
[project.optional-dependencies]

instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
# This version should stay below "1.0" until the fundamentals
1818
# in "TODOS.md" have been addressed. Please revisit the TODOs
1919
# listed there before bumping to a stable version.
20-
__version__ = "0.7b0.dev"
20+
__version__ = "0.8b0.dev"

instrumentation-genai/opentelemetry-instrumentation-google-genai/tests/requirements.oldest.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,10 @@ opentelemetry-api==1.37.0
2525
opentelemetry-sdk==1.37.0
2626
opentelemetry-semantic-conventions==0.58b0
2727
opentelemetry-instrumentation==0.58b0
28-
# TODO: uncomment and update version after release (https://github.com/open-telemetry/opentelemetry-python-contrib/issues/4221)
29-
# opentelemetry-util-genai[upload]==0.2b0
28+
opentelemetry-util-genai[upload]==0.3b0
3029

3130
fsspec==2025.9.0
3231

3332
# Install locally from the folder. This path is relative to the
3433
# root directory, given invocation from "tox" at root level.
3534
-e instrumentation-genai/opentelemetry-instrumentation-google-genai
36-
# TODO: remove local install after release (https://github.com/open-telemetry/opentelemetry-python-contrib/issues/4221)
37-
-e util/opentelemetry-util-genai[upload]

instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py

Lines changed: 61 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,50 @@ def connect_and_execute_query():
3535
return cnx, query
3636

3737

38+
def make_mysql_connection_mock():
39+
cnx = mock.MagicMock()
40+
cnx.database = "test"
41+
cnx.server_host = "localhost"
42+
cnx.server_port = 3306
43+
44+
cursor = mock.MagicMock()
45+
cursor._cnx = cnx
46+
47+
cnx.cursor.return_value = cursor
48+
return cnx
49+
50+
51+
def make_mysql_commenter_mocks(client_version="foobaz"):
52+
"""Create mock objects for MySQL connector with SQL commenter support.
53+
54+
Args:
55+
client_version: The MySQL client version string to return from get_client_info()
56+
57+
Returns:
58+
Tuple of (mock_connect_module, mock_connection, mock_cursor)
59+
"""
60+
mock_connect_module = mock.MagicMock(
61+
__name__="mysql.connector",
62+
__version__="foobar",
63+
threadsafety="123",
64+
apilevel="123",
65+
paramstyle="test",
66+
)
67+
mock_connection = mock.MagicMock()
68+
mock_connection.database = "test"
69+
mock_connection.server_host = "localhost"
70+
mock_connection.server_port = 3306
71+
72+
mock_cursor = mock_connect_module.connect().cursor()
73+
mock_cursor._cnx = mock_connection
74+
mock_cursor._cnx._cmysql.get_client_info.return_value = client_version
75+
76+
mock_connection.cursor.return_value = mock_cursor
77+
mock_connect_module.connect.return_value = mock_connection
78+
79+
return mock_connect_module, mock_connection, mock_cursor
80+
81+
3882
class TestMysqlIntegration(TestBase):
3983
def tearDown(self):
4084
super().tearDown()
@@ -44,6 +88,7 @@ def tearDown(self):
4488
@mock.patch("mysql.connector.connect")
4589
# pylint: disable=unused-argument
4690
def test_instrumentor(self, mock_connect):
91+
mock_connect.return_value = make_mysql_connection_mock()
4792
MySQLInstrumentor().instrument()
4893

4994
connect_and_execute_query()
@@ -68,6 +113,7 @@ def test_instrumentor(self, mock_connect):
68113
@mock.patch("mysql.connector.connect")
69114
# pylint: disable=unused-argument
70115
def test_custom_tracer_provider(self, mock_connect):
116+
mock_connect.return_value = make_mysql_connection_mock()
71117
resource = resources.Resource.create({})
72118
result = self.create_tracer_provider(resource=resource)
73119
tracer_provider, exporter = result
@@ -84,6 +130,7 @@ def test_custom_tracer_provider(self, mock_connect):
84130
@mock.patch("mysql.connector.connect")
85131
# pylint: disable=unused-argument
86132
def test_instrument_connection(self, mock_connect):
133+
mock_connect.return_value = make_mysql_connection_mock()
87134
cnx, query = connect_and_execute_query()
88135

89136
spans_list = self.memory_exporter.get_finished_spans()
@@ -98,6 +145,7 @@ def test_instrument_connection(self, mock_connect):
98145

99146
@mock.patch("mysql.connector.connect")
100147
def test_instrument_connection_no_op_tracer_provider(self, mock_connect):
148+
mock_connect.return_value = make_mysql_connection_mock()
101149
tracer_provider = trace_api.NoOpTracerProvider()
102150
MySQLInstrumentor().instrument(tracer_provider=tracer_provider)
103151
connect_and_execute_query()
@@ -128,17 +176,9 @@ def test_instrument_connection_enable_commenter_dbapi_kwargs(
128176
self.assertEqual(kwargs["enable_attribute_commenter"], True)
129177

130178
def test_instrument_connection_with_dbapi_sqlcomment_enabled(self):
131-
mock_connect_module = mock.MagicMock(
132-
__name__="mysql.connector",
133-
__version__="foobar",
134-
threadsafety="123",
135-
apilevel="123",
136-
paramstyle="test",
179+
mock_connect_module, mock_connection, mock_cursor = (
180+
make_mysql_commenter_mocks()
137181
)
138-
mock_cursor = mock_connect_module.connect().cursor()
139-
mock_cursor._cnx._cmysql.get_client_info.return_value = "foobaz"
140-
mock_connection = mock.MagicMock()
141-
mock_connection.cursor.return_value = mock_cursor
142182

143183
with mock.patch(
144184
"opentelemetry.instrumentation.mysql.mysql.connector",
@@ -166,17 +206,9 @@ def test_instrument_connection_with_dbapi_sqlcomment_enabled(self):
166206
def test_instrument_connection_with_dbapi_sqlcomment_enabled_stmt_enabled(
167207
self,
168208
):
169-
mock_connect_module = mock.MagicMock(
170-
__name__="mysql.connector",
171-
__version__="foobar",
172-
threadsafety="123",
173-
apilevel="123",
174-
paramstyle="test",
209+
mock_connect_module, mock_connection, mock_cursor = (
210+
make_mysql_commenter_mocks()
175211
)
176-
mock_cursor = mock_connect_module.connect().cursor()
177-
mock_cursor._cnx._cmysql.get_client_info.return_value = "foobaz"
178-
mock_connection = mock.MagicMock()
179-
mock_connection.cursor.return_value = mock_cursor
180212

181213
with mock.patch(
182214
"opentelemetry.instrumentation.mysql.mysql.connector",
@@ -205,17 +237,9 @@ def test_instrument_connection_with_dbapi_sqlcomment_enabled_stmt_enabled(
205237
def test_instrument_connection_with_dbapi_sqlcomment_enabled_with_options(
206238
self,
207239
):
208-
mock_connect_module = mock.MagicMock(
209-
__name__="mysql.connector",
210-
__version__="foobar",
211-
threadsafety="123",
212-
apilevel="123",
213-
paramstyle="test",
240+
mock_connect_module, mock_connection, mock_cursor = (
241+
make_mysql_commenter_mocks()
214242
)
215-
mock_cursor = mock_connect_module.connect().cursor()
216-
mock_cursor._cnx._cmysql.get_client_info.return_value = "foobaz"
217-
mock_connection = mock.MagicMock()
218-
mock_connection.cursor.return_value = mock_cursor
219243

220244
with mock.patch(
221245
"opentelemetry.instrumentation.mysql.mysql.connector",
@@ -248,18 +272,9 @@ def test_instrument_connection_with_dbapi_sqlcomment_enabled_with_options(
248272
def test_instrument_connection_with_dbapi_sqlcomment_not_enabled_default(
249273
self,
250274
):
251-
mock_connect_module = mock.MagicMock(
252-
__name__="mysql.connector",
253-
__version__="foobar",
254-
threadsafety="123",
255-
apilevel="123",
256-
paramstyle="test",
275+
mock_connect_module, mock_connection, mock_cursor = (
276+
make_mysql_commenter_mocks()
257277
)
258-
mock_cursor = mock_connect_module.connect().cursor()
259-
mock_cursor._cnx._cmysql.get_client_info.return_value = "foobaz"
260-
mock_cursor = mock_connect_module.connect().cursor()
261-
mock_connection = mock.MagicMock()
262-
mock_connection.cursor.return_value = mock_cursor
263278

264279
with mock.patch(
265280
"opentelemetry.instrumentation.mysql.mysql.connector",
@@ -301,18 +316,7 @@ def test_instrument_enable_commenter_dbapi_kwargs(
301316
def test_instrument_with_dbapi_sqlcomment_enabled(
302317
self,
303318
):
304-
mock_connect_module = mock.MagicMock(
305-
__name__="mysql.connector",
306-
__version__="foobar",
307-
threadsafety="123",
308-
apilevel="123",
309-
paramstyle="test",
310-
)
311-
mock_cursor = mock_connect_module.connect().cursor()
312-
mock_cursor._cnx._cmysql.get_client_info.return_value = "foobaz"
313-
mock_cursor = mock_connect_module.connect().cursor()
314-
mock_connection = mock.MagicMock()
315-
mock_connection.cursor.return_value = mock_cursor
319+
mock_connect_module, _, mock_cursor = make_mysql_commenter_mocks()
316320

317321
with mock.patch(
318322
"opentelemetry.instrumentation.mysql.mysql.connector",
@@ -341,18 +345,7 @@ def test_instrument_with_dbapi_sqlcomment_enabled(
341345
def test_instrument_with_dbapi_sqlcomment_enabled_stmt_enabled(
342346
self,
343347
):
344-
mock_connect_module = mock.MagicMock(
345-
__name__="mysql.connector",
346-
__version__="foobar",
347-
threadsafety="123",
348-
apilevel="123",
349-
paramstyle="test",
350-
)
351-
mock_cursor = mock_connect_module.connect().cursor()
352-
mock_cursor._cnx._cmysql.get_client_info.return_value = "foobaz"
353-
mock_cursor = mock_connect_module.connect().cursor()
354-
mock_connection = mock.MagicMock()
355-
mock_connection.cursor.return_value = mock_cursor
348+
mock_connect_module, _, mock_cursor = make_mysql_commenter_mocks()
356349

357350
with mock.patch(
358351
"opentelemetry.instrumentation.mysql.mysql.connector",
@@ -382,18 +375,7 @@ def test_instrument_with_dbapi_sqlcomment_enabled_stmt_enabled(
382375
def test_instrument_with_dbapi_sqlcomment_enabled_with_options(
383376
self,
384377
):
385-
mock_connect_module = mock.MagicMock(
386-
__name__="mysql.connector",
387-
__version__="foobar",
388-
threadsafety="123",
389-
apilevel="123",
390-
paramstyle="test",
391-
)
392-
mock_cursor = mock_connect_module.connect().cursor()
393-
mock_cursor._cnx._cmysql.get_client_info.return_value = "foobaz"
394-
mock_cursor = mock_connect_module.connect().cursor()
395-
mock_connection = mock.MagicMock()
396-
mock_connection.cursor.return_value = mock_cursor
378+
mock_connect_module, _, mock_cursor = make_mysql_commenter_mocks()
397379

398380
with mock.patch(
399381
"opentelemetry.instrumentation.mysql.mysql.connector",
@@ -427,18 +409,7 @@ def test_instrument_with_dbapi_sqlcomment_enabled_with_options(
427409
def test_instrument_with_dbapi_sqlcomment_not_enabled_default(
428410
self,
429411
):
430-
mock_connect_module = mock.MagicMock(
431-
__name__="mysql.connector",
432-
__version__="foobar",
433-
threadsafety="123",
434-
apilevel="123",
435-
paramstyle="test",
436-
)
437-
mock_cursor = mock_connect_module.connect().cursor()
438-
mock_cursor._cnx._cmysql.get_client_info.return_value = "foobaz"
439-
mock_cursor = mock_connect_module.connect().cursor()
440-
mock_connection = mock.MagicMock()
441-
mock_connection.cursor.return_value = mock_cursor
412+
mock_connect_module, _, mock_cursor = make_mysql_commenter_mocks()
442413

443414
with mock.patch(
444415
"opentelemetry.instrumentation.mysql.mysql.connector",
@@ -462,6 +433,7 @@ def test_instrument_with_dbapi_sqlcomment_not_enabled_default(
462433
@mock.patch("mysql.connector.connect")
463434
# pylint: disable=unused-argument
464435
def test_uninstrument_connection(self, mock_connect):
436+
mock_connect.return_value = make_mysql_connection_mock()
465437
MySQLInstrumentor().instrument()
466438
cnx, query = connect_and_execute_query()
467439

util/opentelemetry-util-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+
## Version 0.3b0 (2026-02-20)
11+
1012
- Add `gen_ai.tool_definitions` to completion hook ([#4181](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4181))
1113
- Add support for emitting inference events and enrich message types. ([#3994](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3994))
1214
- Add support for `server.address`, `server.port` on all signals and additional metric-only attributes

util/opentelemetry-util-genai/src/opentelemetry/util/genai/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "0.3b0.dev"
15+
__version__ = "0.4b0.dev"

0 commit comments

Comments
 (0)