Skip to content

Commit da51a1b

Browse files
Merge pull request #170 from Workiva/myeager-wf/O11Y-4623
O11Y-4623: Update Context API examples in opentelemetry-dart README
2 parents 9cc0911 + 94fb242 commit da51a1b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ final span = tracer.startSpan('doingWork');
147147
span.end();
148148
```
149149

150-
To create children spans, you must set the parent span as "current", and execute work within `withContext`.
150+
To create children spans, use `Context.withSpan` and `Context.execute()` to execute work with a given span.
151151

152152
```dart
153153
final checkoutSpan = tracer.startSpan('checkout');
154-
withContext(setSpan(Context.current, checkoutSpan), () {
154+
Context.current.withSpan(checkoutSpan).execute(() {
155155
final ringUpSpan = tracer.startSpan('ringUp');
156156
...
157157
ringUpSpan.end();

0 commit comments

Comments
 (0)