Sent a trace event in this context with the given name and attributes.
Required: Must not be empty. This is the name of the trace event scoped to this context.
Optionalattributes: AttrMapOptional: key/value Record for attributes on this event only.
Calling this ends this context. Calling other methods on this object afterward MAY cause an exception but WILL fail.
The method takes create a CarrierMap object (empty) and populates it with the carrier for this span. This can be passed across process/host boundaries to continue the span (associate with) on a another process or host (client/server models).
The current CarrierMap with the current context for this span object.
const span = getSpan(name: "mySpanName")
span.addEvent({ name: "MyEventName", attributes: { foo: "bar" }})
const carrier = span.getCurrentSpan()
// Send to remote server or across processes to continue sending event
// for this context. You can still close it here as the other side will
// have its own OTel objects that is must close. This allows for trace
// association in distributed applications.
ctx.end()
This is the tracing context used for tracing both in and out of a process.