|
9 | 9 | from sentry_sdk.traces import StreamedSpan |
10 | 10 | from sentry_sdk.tracing_utils import ( |
11 | 11 | add_query_source, |
12 | | - has_span_streaming_enabled, |
13 | 12 | record_sql_queries, |
14 | 13 | ) |
15 | 14 | from sentry_sdk.utils import ( |
@@ -187,42 +186,22 @@ async def _inner(self: "Connection") -> T: |
187 | 186 | if client.get_integration(AioMySQLIntegration) is None: |
188 | 187 | return await f(self) |
189 | 188 |
|
190 | | - if has_span_streaming_enabled(client.options): |
191 | | - breadcrumb_data = _get_connect_data(self, use_streaming_keys=True) |
| 189 | + breadcrumb_data = _get_connect_data(self, use_streaming_keys=True) |
192 | 190 |
|
193 | | - with capture_internal_exceptions(): |
194 | | - sentry_sdk.add_breadcrumb( |
195 | | - message="connect", category="query", data=breadcrumb_data |
196 | | - ) |
197 | | - |
198 | | - if sentry_sdk.traces.get_current_span() is None: |
199 | | - return await f(self) |
200 | | - |
201 | | - span_attributes: dict[str, Any] = { |
202 | | - "sentry.op": OP.DB, |
203 | | - "sentry.origin": AioMySQLIntegration.origin, |
204 | | - } | breadcrumb_data |
205 | | - |
206 | | - with sentry_sdk.traces.start_span( |
207 | | - name="connect", attributes=span_attributes |
208 | | - ): |
209 | | - return await f(self) |
| 191 | + with capture_internal_exceptions(): |
| 192 | + sentry_sdk.add_breadcrumb( |
| 193 | + message="connect", category="query", data=breadcrumb_data |
| 194 | + ) |
210 | 195 |
|
211 | | - connect_data = _get_connect_data(self) |
| 196 | + if sentry_sdk.traces.get_current_span() is None: |
| 197 | + return await f(self) |
212 | 198 |
|
213 | | - with sentry_sdk.start_span( |
214 | | - op=OP.DB, |
215 | | - name="connect", |
216 | | - origin=AioMySQLIntegration.origin, |
217 | | - ) as span: |
218 | | - _set_db_data(span, self) |
| 199 | + span_attributes: dict[str, Any] = { |
| 200 | + "sentry.op": OP.DB, |
| 201 | + "sentry.origin": AioMySQLIntegration.origin, |
| 202 | + } | breadcrumb_data |
219 | 203 |
|
220 | | - with capture_internal_exceptions(): |
221 | | - sentry_sdk.add_breadcrumb( |
222 | | - message="connect", |
223 | | - category="query", |
224 | | - data=connect_data, |
225 | | - ) |
| 204 | + with sentry_sdk.traces.start_span(name="connect", attributes=span_attributes): |
226 | 205 | return await f(self) |
227 | 206 |
|
228 | 207 | return _inner |
|
0 commit comments