Skip to content

Commit ee29592

Browse files
authored
Merge pull request #559 from future-agi/fix/rewrite-tracing-integrate
rewrite manual tracing integrate event exception and status
2 parents 27d7d33 + f810a50 commit ee29592

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

src/pages/docs/observe/features/manual-tracing/add-events-exceptions-status.mdx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,21 @@ title: "Integrate Events, Exceptions, and Status into Spans"
33
description: "OpenTelemetry (OTEL) provides support for adding Events, Exceptions, and Status into spans."
44
---
55

6-
## What it is
6+
## About
77

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.
99

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.
1313

14-
## Use cases
14+
---
15+
16+
## When to use
1517

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.
1921

2022
---
2123

@@ -52,7 +54,7 @@ description: "OpenTelemetry (OTEL) provides support for adding Events, Exception
5254
// Execute the operation
5355
// For example: const result = someOperation();
5456

55-
currentSpan.add_event("Operation completed!");
57+
currentSpan.addEvent("Operation completed!");
5658
}
5759
```
5860

@@ -157,14 +159,14 @@ description: "OpenTelemetry (OTEL) provides support for adding Events, Exception
157159

158160
## Key concepts
159161

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()`.
164166

165167
---
166168

167-
## What you can do next
169+
## Next Steps
168170

169171
<CardGroup cols={2}>
170172
<Card title="Set Up Tracing" icon="gear" href="/docs/observe/features/manual-tracing/set-up-tracing">

0 commit comments

Comments
 (0)