Skip to content

Commit 7de987d

Browse files
buenaflorkahestcoolguyzone
authored
feat(flutter): document how to add data to spans/transactions (#12367)
* add span data info to dart * update flutter page * Apply suggestions from code review Co-authored-by: Karl Heinz Struggl <[email protected]> * Apply suggestions from code review Co-authored-by: Alex Krawiec <[email protected]> * Update dart.mdx * Update dart.mdx --------- Co-authored-by: Karl Heinz Struggl <[email protected]> Co-authored-by: Alex Krawiec <[email protected]>
1 parent c5c59c5 commit 7de987d

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

docs/platforms/dart/tracing/instrumentation/custom-instrumentation.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ To capture transactions and spans customized to your organization's needs, you m
1717
<PlatformContent includePath="performance/retrieve-transaction" />
1818

1919
<PlatformContent includePath="performance/connect-errors-spans" />
20+
21+
<PlatformContent includePath="performance/improving-data" />

docs/platforms/flutter/tracing/instrumentation/custom-instrumentation.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ To capture transactions and spans customized to your organization's needs, you m
1717
<PlatformContent includePath="performance/retrieve-transaction" />
1818

1919
<PlatformContent includePath="performance/connect-errors-spans" />
20+
21+
<PlatformContent includePath="performance/improving-data" />
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Adding Data Attributes to Transactions and Spans
2+
3+
You can add data attributes to your transactions and spans. This data is visible in the trace explorer in Sentry. Data attributes can be of type `String`, `int`, `double` or `bool`, as well as (non-mixed) arrays of these types:
4+
5+
### For Transactions
6+
7+
```dart
8+
final transaction = Sentry.startTransaction('my-transaction', 'http.server');
9+
transaction.setData('data_attribute_1', 'value1');
10+
transaction.setData('data_attribute_2', 42);
11+
transaction.setData('data_attribute_3', true);
12+
13+
transaction.setData('data_attribute_4', ['value1', 'value2']);
14+
transaction.setData('data_attribute_5', [42, 43]);
15+
transaction.setData('data_attribute_6', [true, false]);
16+
```
17+
18+
### For Spans
19+
20+
```dart
21+
final span = parent.startChild('http.client');
22+
span.setData('data_attribute_1', 'value1');
23+
span.setData('data_attribute_2', 42);
24+
span.setData('data_attribute_3', true);
25+
26+
span.setData('data_attribute_4', ['value1', 'value2']);
27+
span.setData('data_attribute_5', [42, 43]);
28+
span.setData('data_attribute_6', [true, false]);
29+
```

0 commit comments

Comments
 (0)