Skip to content

Commit 3c4d18c

Browse files
authored
ref(mysql): remove SpanAttributes (#3616)
* ref(mysql): remove SpanAttributes * fix imports
1 parent b74633a commit 3c4d18c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
from opentelemetry import trace as trace_api
2121
from opentelemetry.instrumentation.mysql import MySQLInstrumentor
2222
from opentelemetry.sdk import resources
23-
from opentelemetry.semconv.trace import SpanAttributes
23+
from opentelemetry.semconv._incubating.attributes.db_attributes import (
24+
DB_STATEMENT,
25+
)
2426
from opentelemetry.test.test_base import TestBase
2527

2628

@@ -157,7 +159,7 @@ def test_instrument_connection_with_dbapi_sqlcomment_enabled(self):
157159
f"Select 1 /*db_driver='mysql.connector%%3Afoobar',dbapi_level='123',dbapi_threadsafety='123',driver_paramstyle='test',mysql_client_version='foobaz',traceparent='00-{trace_id}-{span_id}-01'*/;",
158160
)
159161
self.assertEqual(
160-
span.attributes[SpanAttributes.DB_STATEMENT],
162+
span.attributes[DB_STATEMENT],
161163
"Select 1;",
162164
)
163165

@@ -196,7 +198,7 @@ def test_instrument_connection_with_dbapi_sqlcomment_enabled_stmt_enabled(
196198
f"Select 1 /*db_driver='mysql.connector%%3Afoobar',dbapi_level='123',dbapi_threadsafety='123',driver_paramstyle='test',mysql_client_version='foobaz',traceparent='00-{trace_id}-{span_id}-01'*/;",
197199
)
198200
self.assertEqual(
199-
span.attributes[SpanAttributes.DB_STATEMENT],
201+
span.attributes[DB_STATEMENT],
200202
f"Select 1 /*db_driver='mysql.connector%%3Afoobar',dbapi_level='123',dbapi_threadsafety='123',driver_paramstyle='test',mysql_client_version='foobaz',traceparent='00-{trace_id}-{span_id}-01'*/;",
201203
)
202204

@@ -239,7 +241,7 @@ def test_instrument_connection_with_dbapi_sqlcomment_enabled_with_options(
239241
f"Select 1 /*db_driver='mysql.connector%%3Afoobar',dbapi_threadsafety='123',mysql_client_version='foobaz',traceparent='00-{trace_id}-{span_id}-01'*/;",
240242
)
241243
self.assertEqual(
242-
span.attributes[SpanAttributes.DB_STATEMENT],
244+
span.attributes[DB_STATEMENT],
243245
"Select 1;",
244246
)
245247

@@ -274,7 +276,7 @@ def test_instrument_connection_with_dbapi_sqlcomment_not_enabled_default(
274276
spans_list = self.memory_exporter.get_finished_spans()
275277
span = spans_list[0]
276278
self.assertEqual(
277-
span.attributes[SpanAttributes.DB_STATEMENT],
279+
span.attributes[DB_STATEMENT],
278280
"Select 1;",
279281
)
280282

@@ -332,7 +334,7 @@ def test_instrument_with_dbapi_sqlcomment_enabled(
332334
f"Select 1 /*db_driver='mysql.connector%%3Afoobar',dbapi_level='123',dbapi_threadsafety='123',driver_paramstyle='test',mysql_client_version='foobaz',traceparent='00-{trace_id}-{span_id}-01'*/;",
333335
)
334336
self.assertEqual(
335-
span.attributes[SpanAttributes.DB_STATEMENT],
337+
span.attributes[DB_STATEMENT],
336338
"Select 1;",
337339
)
338340

@@ -373,7 +375,7 @@ def test_instrument_with_dbapi_sqlcomment_enabled_stmt_enabled(
373375
f"Select 1 /*db_driver='mysql.connector%%3Afoobar',dbapi_level='123',dbapi_threadsafety='123',driver_paramstyle='test',mysql_client_version='foobaz',traceparent='00-{trace_id}-{span_id}-01'*/;",
374376
)
375377
self.assertEqual(
376-
span.attributes[SpanAttributes.DB_STATEMENT],
378+
span.attributes[DB_STATEMENT],
377379
f"Select 1 /*db_driver='mysql.connector%%3Afoobar',dbapi_level='123',dbapi_threadsafety='123',driver_paramstyle='test',mysql_client_version='foobaz',traceparent='00-{trace_id}-{span_id}-01'*/;",
378380
)
379381

@@ -418,7 +420,7 @@ def test_instrument_with_dbapi_sqlcomment_enabled_with_options(
418420
f"Select 1 /*db_driver='mysql.connector%%3Afoobar',dbapi_threadsafety='123',mysql_client_version='foobaz',traceparent='00-{trace_id}-{span_id}-01'*/;",
419421
)
420422
self.assertEqual(
421-
span.attributes[SpanAttributes.DB_STATEMENT],
423+
span.attributes[DB_STATEMENT],
422424
"Select 1;",
423425
)
424426

@@ -453,7 +455,7 @@ def test_instrument_with_dbapi_sqlcomment_not_enabled_default(
453455
spans_list = self.memory_exporter.get_finished_spans()
454456
span = spans_list[0]
455457
self.assertEqual(
456-
span.attributes[SpanAttributes.DB_STATEMENT],
458+
span.attributes[DB_STATEMENT],
457459
"Select 1;",
458460
)
459461

0 commit comments

Comments
 (0)