Skip to content

Commit 95cdbe2

Browse files
add event recording updates to docs (#1667)
1 parent 5a5986f commit 95cdbe2

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

runtime/fundamentals/open_telemetry.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,21 @@ and
388388
added to them. Events are points in time that are associated with the span.
389389
Links are references to other spans.
390390

391+
```ts
392+
// Add an event to the span
393+
span.addEvent("button_clicked", {
394+
id: "submit-button",
395+
action: "submit",
396+
});
397+
398+
// Add an event with a timestamp
399+
span.addEvent("process_completed", { status: "success" }, Date.now());
400+
```
401+
402+
Events can include optional attributes similar to spans. They are useful for
403+
marking significant moments within the span's lifetime without creating separate
404+
spans.
405+
391406
Spans can also be created manually with `tracer.startSpan` which returns a span
392407
object. This method does not set the created span as the active span, so it will
393408
not automatically be used as the parent span for any spans created later, or any
@@ -651,7 +666,6 @@ While the OpenTelemetry integration for Deno is in development, there are some
651666
limitations to be aware of:
652667

653668
- Traces are always sampled (i.e. `OTEL_TRACE_SAMPLER=parentbased_always_on`).
654-
- Traces do not support events.
655669
- Traces only support links with no attributes.
656670
- Automatic propagation of the trace context in `Deno.serve` and `fetch` is not
657671
supported.

0 commit comments

Comments
 (0)