This repository was archived by the owner on Mar 31, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,9 +121,30 @@ def test_trace_grpc_error(self):
121121 ) as span :
122122 from google .api_core .exceptions import DataLoss
123123
124- raise _make_rpc_error ( DataLoss )
124+ raise DataLoss ( "error" )
125125
126126 span_list = self .memory_exporter .get_finished_spans ()
127127 self .assertEqual (len (span_list ), 1 )
128128 span = span_list [0 ]
129129 self .assertEqual (span .status .canonical_code , StatusCanonicalCode .DATA_LOSS )
130+
131+ def test_trace_codeless_error (self ):
132+ extra_attributes = {"db.instance" : "database_name" }
133+
134+ expected_attributes = {
135+ "db.type" : "spanner" ,
136+ "db.url" : "spanner.googleapis.com:443" ,
137+ "net.host.name" : "spanner.googleapis.com:443" ,
138+ }
139+ expected_attributes .update (extra_attributes )
140+
141+ with self .assertRaises (GoogleAPICallError ):
142+ with _opentelemetry_tracing .trace_call (
143+ "CloudSpanner.Test" , _make_session (), extra_attributes
144+ ) as span :
145+ raise GoogleAPICallError ("error" )
146+
147+ span_list = self .memory_exporter .get_finished_spans ()
148+ self .assertEqual (len (span_list ), 1 )
149+ span = span_list [0 ]
150+ self .assertIsNone (span .status .canonical_code )
You can’t perform that action at this time.
0 commit comments