Skip to content

Commit f21ad94

Browse files
committed
Set span attributes immediately on creation, rather than after the span has been created. This allows the traces_sampler to see the attributes and make decisions based on them
1 parent fd3ee4e commit f21ad94

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

sentry_sdk/integrations/asyncpg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ async def _inner(*args: "Any", **kwargs: "Any") -> "T":
198198
except IndexError:
199199
pass
200200

201-
with sentry_sdk.traces.start_span(name="connect") as span:
202-
span.set_attributes(span_attributes)
203-
201+
with sentry_sdk.traces.start_span(
202+
name="connect", attributes=span_attributes
203+
) as span:
204204
with capture_internal_exceptions():
205205
sentry_sdk.add_breadcrumb(
206206
message="connect", category="query", data=span_attributes

0 commit comments

Comments
 (0)