Skip to content

Commit e3e12a4

Browse files
committed
WL#16963: Update the OpenTelemetry version
The required Python OpenTelemetry version was updated to 1.33.1. Change-Id: I10497da2fe281b59a27772220e0b4162efd70efe
1 parent 4b0ebc6 commit e3e12a4

File tree

3 files changed

+30
-18
lines changed

3 files changed

+30
-18
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Full release notes:
1111
v9.4.0
1212
======
1313

14+
- WL#16963: Update the OpenTelemetry version
1415
- WL#16962: Update the Python Protobuf version
1516
- BUG#37820231: Text based django ORM filters doesn't work with Connector/Python
1617
- BUG#37806057: Rename extra option (when installing wheel package) to install webauthn functionality dependencies

mysql-connector-python/setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ def main() -> None:
158158
"gssapi": ["gssapi==1.8.3"],
159159
"webauthn": ["fido2==1.1.2"],
160160
"telemetry": [
161-
"opentelemetry-api==1.18.0",
162-
"opentelemetry-sdk==1.18.0",
163-
"opentelemetry-exporter-otlp-proto-http==1.18.0",
161+
"opentelemetry-api==1.33.1",
162+
"opentelemetry-sdk==1.33.1",
163+
"opentelemetry-exporter-otlp-proto-http==1.33.1",
164164
],
165165
},
166166
)

mysql-connector-python/tests/otel/test_instrumentation.py

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,8 @@ class PythonWithGlobalInstSpanTests(tests.MySQLConnectorTests):
370370
new_user_name = "ramon"
371371
new_user_password = "s3cr3t"
372372
new_database = "colors"
373-
new_user_stmt = (
374-
"CREATE USER '{new_user_name}'@'{server_host}' IDENTIFIED BY '{new_user_password}'"
375-
)
376-
grant_stmt = (
377-
"GRANT ALL PRIVILEGES ON *.* TO '{new_user_name}'@'{server_host}' WITH GRANT OPTION"
378-
)
373+
new_user_stmt = "CREATE USER '{new_user_name}'@'{server_host}' IDENTIFIED BY '{new_user_password}'"
374+
grant_stmt = "GRANT ALL PRIVILEGES ON *.* TO '{new_user_name}'@'{server_host}' WITH GRANT OPTION"
379375
table_name = "employees"
380376
create_stmt = f"""CREATE TABLE {table_name} (
381377
emp_no int,
@@ -412,7 +408,7 @@ def setUp(self) -> None:
412408
self.provider.add_span_processor(processor)
413409
self.tracer = trace.get_tracer(__name__, tracer_provider=self.provider)
414410
self.cnx_config = self.get_clean_mysql_config()
415-
self.server_host = self.cnx_config['host']
411+
self.server_host = self.cnx_config["host"]
416412
self.cnx_config["use_pure"] = self.pure_python
417413

418414
# Instrumentor
@@ -555,9 +551,11 @@ def _run_client_app1(
555551
app span or not.
556552
"""
557553
num_query_spans_client_app = 13
558-
with self.tracer.start_as_current_span(
559-
"app"
560-
) if with_client_span else nullcontext():
554+
with (
555+
self.tracer.start_as_current_span("app")
556+
if with_client_span
557+
else nullcontext()
558+
):
561559
cnx = self._otel_connect(**self.cnx_config)
562560

563561
with cnx.cursor(**cur_kwargs) as cur:
@@ -570,7 +568,9 @@ def _run_client_app1(
570568
cur.execute(f"DROP TABLE IF EXISTS {self.table_name}")
571569

572570
# create a new user
573-
cur.execute(f"DROP USER IF EXISTS '{self.new_user_name}'@'{self.server_host}'")
571+
cur.execute(
572+
f"DROP USER IF EXISTS '{self.new_user_name}'@'{self.server_host}'"
573+
)
574574
cur.execute(
575575
self.new_user_stmt.format(
576576
new_user_name=self.new_user_name,
@@ -612,9 +612,11 @@ def _run_client_app2(
612612
table_name = "my_table"
613613
proc_name = "my_procedure"
614614

615-
with self.tracer.start_as_current_span(
616-
"app"
617-
) if with_client_span else nullcontext():
615+
with (
616+
self.tracer.start_as_current_span("app")
617+
if with_client_span
618+
else nullcontext()
619+
):
618620
cnx = self._otel_connect(**self.cnx_config)
619621

620622
with cnx.cursor(**cur_kwargs) as cur:
@@ -731,7 +733,8 @@ def _check_error_event(self, span: DbDocType, ex: Exception) -> None:
731733
events["exception"]["exception.message"]["string_value"], str(ex)
732734
)
733735
self.assertEqual(
734-
events["exception"]["exception.type"]["string_value"], ex.__class__.__name__
736+
events["exception"]["exception.type"]["string_value"],
737+
f"{ex.__class__.__module__}.{ex.__class__.__name__}",
735738
)
736739

737740
def test_connection_error(self) -> None:
@@ -1002,6 +1005,10 @@ def test_local_uninstrumentation(self) -> None:
10021005
cnx.close()
10031006

10041007

1008+
@unittest.skipIf(
1009+
True,
1010+
reason="Deactivating it. Fails may happen depending on the machine workload. It can be misleading.",
1011+
)
10051012
class PythonPerformanceTests(tests.MySQLConnectorTests):
10061013
"""Compare the connector's performance when otel tracing is on/off."""
10071014

@@ -1146,6 +1153,10 @@ def test_benchmark3(self):
11461153
)
11471154

11481155

1156+
@unittest.skipIf(
1157+
True,
1158+
reason="Deactivating it. Fails may happen depending on the machine workload. It can be misleading.",
1159+
)
11491160
@unittest.skipIf(HAVE_CEXT == False, reason=NO_CEXT_ERR)
11501161
class CextPerformanceTests(PythonPerformanceTests):
11511162
"""Compare the connector's performance when otel tracing is on/off."""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy