Skip to content

Commit 42e08a4

Browse files
author
Andrew Kent
committed
Add error reporting documentation.
1 parent 566f937 commit 42e08a4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

dd-trace/docs/opentracing-api.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,23 @@ Baggage is very similar to tags, but has important distinctions. Baggage is:
114114
valuableSpan.setBaggageItem("username", "modernmajorgeneral");
115115
```
116116

117+
### Errors
118+
119+
Errors are manually captured in a span by setting the error flag and logging the error attributes.
120+
121+
```java
122+
try {
123+
// your code
124+
} catch (Exception e) {
125+
// capture error
126+
ActiveSpan span = GlobalTracer.get().activeSpan();
127+
Tags.ERROR.set(span, Boolean.TRUE);
128+
span.log(Collections.singletonMap("error.object", e));
129+
130+
// recovery code
131+
}
132+
```
133+
117134
## OpenTracing Asynchronous API
118135

119136
An `ActiveSpan` can generate a `Continuation` as a way of propagating traces from across a thread boundary.

0 commit comments

Comments
 (0)