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: src/pages/docs/observe/features/manual-tracing/add-events-exceptions-status.mdx
+17-15Lines changed: 17 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,19 +3,21 @@ title: "Integrate Events, Exceptions, and Status into Spans"
3
3
description: "OpenTelemetry (OTEL) provides support for adding Events, Exceptions, and Status into spans."
4
4
---
5
5
6
-
## What it is
6
+
## About
7
7
8
-
**Events, Exceptions, and Status** are three OpenTelemetry primitives for enriching spans with runtime signal:
8
+
Spans capture timing and attributes, but they do not automatically record what happened during execution or whether it succeeded. Events, exceptions, and status fill that gap.
9
9
10
-
-**Events** — Readable messages that mark significant moments during a span's lifecycle, similar to basic logs.
11
-
-**Status** — A success or failure indicator set on the span to surface errors in distributed traces.
12
-
-**Exceptions** — Detailed exception records attached to a span alongside a status update, for comprehensive failure debugging.
10
+
-**Events**: Timestamped messages that mark key moments during a span, similar to log lines.
11
+
-**Status**: Marks the span as OK or ERROR so failures are visible in the dashboard and alerting.
12
+
-**Exceptions**: Attaches full error details (type, message, stack trace) to the span for debugging.
13
13
14
-
## Use cases
14
+
---
15
+
16
+
## When to use
15
17
16
-
-**Event logging** — Capture significant actions in your application's workflow at specific moments during span execution.
17
-
-**Error surfacing** — Assign an error status to a span when an exception arises so it's visible when identifying and troubleshooting issues in distributed systems.
18
-
-**Exception recording** — Log detailed exception information alongside span status to get a full view of failures for debugging.
18
+
-**Mark key moments during execution**: Add events at important steps (e.g. "cache miss", "retrying request") to understand what happened inside a span without creating child spans.
19
+
-**Surface errors in traces**: Set an ERROR status on a span so failures are immediately visible when scanning traces in the dashboard.
20
+
-**Capture full failure context**: Record exceptions alongside status so the error type, message, and stack trace are available for debugging.
19
21
20
22
---
21
23
@@ -52,7 +54,7 @@ description: "OpenTelemetry (OTEL) provides support for adding Events, Exception
52
54
// Execute the operation
53
55
// For example: const result = someOperation();
54
56
55
-
currentSpan.add_event("Operation completed!");
57
+
currentSpan.addEvent("Operation completed!");
56
58
}
57
59
```
58
60
@@ -157,14 +159,14 @@ description: "OpenTelemetry (OTEL) provides support for adding Events, Exception
157
159
158
160
## Key concepts
159
161
160
-
-**`add_event()` / `addEvent()`** — Attaches a timestamped message to the span at the moment it's called. Useful for logging discrete actions without creating a new span.
161
-
-**`set_status()` / `setStatus()`** — Sets the span's status to `OK` or `ERROR`. An `ERROR` status with a message surfaces the failure in trace UIs and alerting.
162
-
-**`record_exception()` / `recordException()`** — Attaches full exception details (type, message, stack trace) as a span event. Always pair with `set_status(ERROR)` for complete failure context.
163
-
-**`is_recording()`** — Guards against no-op spans. Always check before setting attributes or events on a span retrieved from `get_current_span()`.
162
+
-**`add_event()` / `addEvent()`**:Attaches a timestamped message to the span at the moment it's called. Useful for logging discrete actions without creating a new span.
163
+
-**`set_status()` / `setStatus()`**:Sets the span's status to `OK` or `ERROR`. An `ERROR` status with a message surfaces the failure in trace UIs and alerting.
164
+
-**`record_exception()` / `recordException()`**:Attaches full exception details (type, message, stack trace) as a span event. Always pair with `set_status(ERROR)` for complete failure context.
165
+
-**`is_recording()`**:Guards against no-op spans. Always check before setting attributes or events on a span retrieved from `get_current_span()`.
164
166
165
167
---
166
168
167
-
## What you can do next
169
+
## Next Steps
168
170
169
171
<CardGroupcols={2}>
170
172
<Cardtitle="Set Up Tracing"icon="gear"href="/docs/observe/features/manual-tracing/set-up-tracing">
0 commit comments