You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/platforms/python/tracing/instrumentation/custom-instrumentation/index.mdx
+22-5
Original file line number
Diff line number
Diff line change
@@ -238,8 +238,6 @@ def eat_slice(slice):
238
238
239
239
## Improving Data on Transactions and Spans
240
240
241
-
### Adding Data Attributes to Transactions
242
-
243
241
You can add data attributes to your transactions. This data is visible in the trace explorer in Sentry. Data attributes can be of type `string`, `number` or `boolean`, as well as (non-mixed) arrays of these types:
244
242
245
243
```python
@@ -253,9 +251,7 @@ with sentry_sdk.start_transaction(name="my-transaction") as transaction:
You can add data attributes to your spans. This data is visible in the trace explorer in Sentry. Data attributes can be of type `string`, `number` or `boolean`, as well as (non-mixed) arrays of these types:
254
+
You can add data attributes to your spans the same way, with the same type restrictions as described above.
259
255
260
256
```python
261
257
with sentry_sdk.start_span(name="my-span") as span:
@@ -267,3 +263,24 @@ with sentry_sdk.start_span(name="my-span") as span:
To attach data attributes to the transaction and all its spans, you can use <PlatformLinkto="/configuration/filtering/#using-before-send-transaction">`before_send_transaction`</PlatformLink>:
268
+
269
+
```python
270
+
defmy_before_send_transaction(event, hint):
271
+
# Set the data attribute "foo" to "bar" on every span belonging to this
0 commit comments