Skip to content

Commit 0151460

Browse files
authored
[Python ]Add span/transaction set_data docs (#12276)
1 parent 1ced258 commit 0151460

File tree

1 file changed

+32
-0
lines changed
  • docs/platforms/python/tracing/instrumentation/custom-instrumentation

1 file changed

+32
-0
lines changed

docs/platforms/python/tracing/instrumentation/custom-instrumentation/index.mdx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,35 @@ def eat_slice(slice):
235235
if span is not None:
236236
span.set_tag("slice_id", slice.id)
237237
```
238+
239+
## Improving Data on Transactions and Spans
240+
241+
### Adding Data Attributes to Transactions
242+
243+
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+
245+
```python
246+
with sentry_sdk.start_transaction(name="my-transaction") as transaction:
247+
transaction.set_data("my-data-attribute-1", "value1")
248+
transaction.set_data("my-data-attribute-2", 42)
249+
transaction.set_data("my-data-attribute-3", True)
250+
251+
transaction.set_data("my-data-attribute-4", ["value1", "value2", "value3"])
252+
transaction.set_data("my-data-attribute-5", [42, 43, 44])
253+
transaction.set_data("my-data-attribute-6", [True, False, True])
254+
```
255+
256+
### Adding Data Attributes to Spans
257+
258+
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:
259+
260+
```python
261+
with sentry_sdk.start_span(name="my-span") as span:
262+
span.set_data("my-data-attribute-1", "value1")
263+
span.set_data("my-data-attribute-2", 42)
264+
span.set_data("my-data-attribute-3", True)
265+
266+
span.set_data("my-data-attribute-4", ["value1", "value2", "value3"])
267+
span.set_data("my-data-attribute-5", [42, 43, 44])
268+
span.set_data("my-data-attribute-6", [True, False, True])
269+
```

0 commit comments

Comments
 (0)