@botmesh/core - v2.0.0-alpha.2
    Preparing search index...

    Interface BotTracing

    Tracing facade of a bot (bot.tracing), also used by plugins (@botmesh/ai). Without BotConfig.telemetry it is a no-op (enabled === false).

    interface BotTracing {
        enabled: boolean;
        startSpan(name: string, options?: SpanOptions): BotSpan;
        activeSpan(): BotSpan | undefined;
        withSpan<T>(span: BotSpan, fn: () => T): T;
        trace<T>(name: string, options: SpanOptions, fn: (span: BotSpan) => T): T;
        recordError(span: BotSpan, error: unknown): void;
        idAttribute(id: string): string | undefined;
    }
    Index
    enabled: boolean
    • Run fn with span active (core context and the backend's). Returns fn's value unchanged.

      Type Parameters

      • T

      Parameters

      Returns T

    • Start a span, run fn inside it and end it when fn returns or its promise settles (a throw/rejection sets status error and records the sanitized exception). Returns fn's own value or promise — never a derived one.

      Type Parameters

      • T

      Parameters

      Returns T

    • Record a sanitized error on span (status error, error.type, exception event).

      Parameters

      Returns void

    • Apply the ids policy to an id (undefined under 'omit'). For plugins that tag their own spans.

      Parameters

      • id: string

      Returns string | undefined