@@ -111,9 +111,7 @@ def test_transactions(sentry_init, capture_events, mongo_server, with_pii):
111111
112112
113113@pytest .mark .parametrize ("with_pii" , [False , True ])
114- def test_transactions_span_streaming (
115- sentry_init , capture_items , mongo_server , with_pii
116- ):
114+ def test_segment_span_streaming (sentry_init , capture_items , mongo_server , with_pii ):
117115 sentry_init (
118116 integrations = [PyMongoIntegration ()],
119117 traces_sample_rate = 1.0 ,
@@ -124,7 +122,7 @@ def test_transactions_span_streaming(
124122
125123 connection = MongoClient (mongo_server .uri )
126124
127- with sentry_sdk .traces .start_span (name = "test_transaction " ):
125+ with sentry_sdk .traces .start_span (name = "test_segment " ):
128126 list (
129127 connection ["test_db" ]["test_collection" ].find ({"foobar" : 1 })
130128 ) # force query execution
@@ -140,21 +138,21 @@ def test_transactions_span_streaming(
140138 assert len (spans ) == 4
141139
142140 (find , insert_success , insert_fail , segment ) = spans
143- assert segment ["name" ] == "test_transaction "
141+ assert segment ["name" ] == "test_segment "
144142
145143 for span in find , insert_success , insert_fail :
146144 attrs = span ["attributes" ]
147- assert attrs [SPANDATA . DB_SYSTEM ] == "mongodb"
145+ assert attrs ["db.system.name" ] == "mongodb"
148146 assert attrs [SPANDATA .DB_DRIVER_NAME ] == "pymongo"
149- assert attrs ["db.name " ] == "test_db"
147+ assert attrs ["db.namespace " ] == "test_db"
150148 assert attrs [SPANDATA .SERVER_ADDRESS ] == "localhost"
151149 assert attrs [SPANDATA .SERVER_PORT ] == mongo_server .port
152150 assert attrs ["sentry.op" ] == "db"
153151 assert attrs ["sentry.origin" ] == "auto.db.pymongo"
154152
155- assert find ["attributes" ][SPANDATA . DB_OPERATION ] == "find"
156- assert insert_success ["attributes" ][SPANDATA . DB_OPERATION ] == "insert"
157- assert insert_fail ["attributes" ][SPANDATA . DB_OPERATION ] == "insert"
153+ assert find ["attributes" ]["db.operation.name" ] == "find"
154+ assert insert_success ["attributes" ]["db.operation.name" ] == "insert"
155+ assert insert_fail ["attributes" ]["db.operation.name" ] == "insert"
158156
159157 assert find ["name" ].startswith ('{"find' )
160158 assert insert_success ["name" ].startswith ('{"insert' )
@@ -244,10 +242,10 @@ def test_breadcrumbs_span_streaming(sentry_init, capture_items, mongo_server, wi
244242 assert crumb ["type" ] == "db"
245243
246244 data = crumb ["data" ]
247- assert data ["db.name " ] == "test_db"
248- assert data [SPANDATA . DB_SYSTEM ] == "mongodb"
249- assert data [SPANDATA . DB_DRIVER_NAME ] == "pymongo"
250- assert data [SPANDATA . DB_OPERATION ] == "find"
245+ assert data ["db.namespace " ] == "test_db"
246+ assert data ["db.system.name" ] == "mongodb"
247+ assert data ["db.driver.name" ] == "pymongo"
248+ assert data ["db.operation.name" ] == "find"
251249 assert data ["db.collection.name" ] == "test_collection"
252250 assert data ["sentry.op" ] == "db"
253251 assert data ["sentry.origin" ] == "auto.db.pymongo"
@@ -581,7 +579,7 @@ def test_span_origin_span_streaming(sentry_init, capture_items, mongo_server):
581579
582580 connection = MongoClient (mongo_server .uri )
583581
584- with sentry_sdk .traces .start_span (name = "test_transaction " ):
582+ with sentry_sdk .traces .start_span (name = "test_segment " ):
585583 list (
586584 connection ["test_db" ]["test_collection" ].find ({"foobar" : 1 })
587585 ) # force query execution
@@ -590,7 +588,7 @@ def test_span_origin_span_streaming(sentry_init, capture_items, mongo_server):
590588 spans = [item .payload for item in items ]
591589 assert len (spans ) == 2
592590 (db_span , segment ) = spans
593- assert segment ["name" ] == "test_transaction "
591+ assert segment ["name" ] == "test_segment "
594592 assert db_span ["attributes" ]["sentry.origin" ] == "auto.db.pymongo"
595593
596594
@@ -604,14 +602,14 @@ def test_span_streaming_status_on_success(sentry_init, capture_items, mongo_serv
604602
605603 connection = MongoClient (mongo_server .uri )
606604
607- with sentry_sdk .traces .start_span (name = "test_transaction " ):
605+ with sentry_sdk .traces .start_span (name = "test_segment " ):
608606 connection ["test_db" ]["test_collection" ].insert_one ({"foo" : 1 })
609607 sentry_sdk .flush ()
610608
611609 spans = [item .payload for item in items ]
612610 assert len (spans ) == 2
613611 (db_span , segment ) = spans
614- assert segment ["name" ] == "test_transaction "
612+ assert segment ["name" ] == "test_segment "
615613 assert db_span ["status" ] == "ok"
616614
617615
@@ -625,7 +623,7 @@ def test_span_streaming_status_on_failure(sentry_init, capture_items, mongo_serv
625623
626624 connection = MongoClient (mongo_server .uri )
627625
628- with sentry_sdk .traces .start_span (name = "test_transaction " ):
626+ with sentry_sdk .traces .start_span (name = "test_segment " ):
629627 try :
630628 connection ["test_db" ]["erroneous" ].insert_many ([{"bar" : 3 }])
631629 pytest .fail ("Request should raise" )
@@ -638,5 +636,5 @@ def test_span_streaming_status_on_failure(sentry_init, capture_items, mongo_serv
638636 assert len (spans ) == 2
639637 (db_span , segment ) = spans
640638
641- assert segment ["name" ] == "test_transaction "
639+ assert segment ["name" ] == "test_segment "
642640 assert db_span ["status" ] == "error"
0 commit comments