Anaconda OpenTelemetry for Typescript
    Preparing search index...

    Interface ASpan

    This is the tracing context used for tracing both in and out of a process.

    interface ASpan {
        addEvent(name: string, attributes?: AttrMap): void;
        end(): void;
        getCurrentCarrier(): CarrierMap;
    }
    Index

    Methods

    • Sent a trace event in this context with the given name and attributes.

      Parameters

      • name: string

        Required: Must not be empty. This is the name of the trace event scoped to this context.

      • Optionalattributes: AttrMap

        Optional: key/value Record for attributes on this event only.

      Returns void

           const ctx = createRootTraceContext({name: "mySpanName"})
      ctx.addEvent({ name: "MyEventName", attributes: { foo: "bar" }})
      ctx.end()
    • Calling this ends this context. Calling other methods on this object afterward MAY cause an exception but WILL fail.

      Returns void

    • 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).

      Returns CarrierMap

      The current CarrierMap with the current context for this span object.

      This method does not throw any known exceptions.

           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()