Concrete implementation of LDGraphTracker.

Construct directly or reconstruct from a resumption token via LDGraphTrackerImpl.fromResumptionToken.

Hierarchy

  • LDGraphTrackerImpl

Implements

Constructors

  • Parameters

    • _ldClient: LDClientMin
    • _runId: string
    • _graphKey: string
    • _variationKey: undefined | string
    • _version: number
    • _context: LDContext

    Returns LDGraphTrackerImpl

Properties

_context: LDContext
_graphKey: string
_ldClient: LDClientMin
_runId: string
_summary: LDGraphMetricSummary = {}
_variationKey: undefined | string
_version: number

Accessors

  • get resumptionToken(): string
  • A URL-safe Base64-encoded (RFC 4648, no padding) token encoding the tracker's identity. Pass this token to LDGraphTrackerImpl.fromResumptionToken to reconstruct the tracker across process boundaries, preserving the original runId.

    Security note: The token contains the flag variation key and version. If passed to an untrusted client (e.g., a browser) this could expose feature-flag targeting details. Keep the token server-side and use an opaque reference in client-facing APIs.

    Returns string

Methods

  • Tracks the total duration of the graph execution in milliseconds. Emits event $ld:ai:graph:duration:total with the duration as the metric value. At-most-once: subsequent calls are dropped with a warning.

    Parameters

    • durationMs: number

      Duration in milliseconds.

    Returns void

  • Tracks a failed handoff between two nodes. Emits event $ld:ai:graph:handoff_failure with metric value 1.

    Parameters

    • sourceKey: string

      Config key of the source node.

    • targetKey: string

      Config key of the target node.

    Returns void

  • Tracks a successful handoff between two nodes. Emits event $ld:ai:graph:handoff_success with metric value 1.

    Parameters

    • sourceKey: string

      Config key of the source node.

    • targetKey: string

      Config key of the target node.

    Returns void

  • Tracks an unsuccessful graph invocation. Emits event $ld:ai:graph:invocation_failure with metric value 1. At-most-once: subsequent calls are dropped with a warning.

    Returns void

  • Tracks the execution path through the graph. Emits event $ld:ai:graph:path with metric value 1. The data payload includes the path array in addition to standard track data. At-most-once: subsequent calls are dropped with a warning.

    Parameters

    • path: string[]

      An ordered array of agent config keys representing the execution path.

    Returns void

  • Tracks when a node redirects to a different target than originally specified. Emits event $ld:ai:graph:redirect with metric value 1.

    Parameters

    • sourceKey: string

      Config key of the source node.

    • redirectedTarget: string

      Config key of the actual target node.

    Returns void

  • Tracks aggregate token usage across the entire graph invocation. Emits event $ld:ai:graph:total_tokens with the total token count as the metric value. At-most-once: subsequent calls are dropped with a warning.

    Parameters

    Returns void

  • Reconstructs an LDGraphTrackerImpl from a resumption token, preserving the original runId so all events continue to be correlated under the same run.

    Security note: The token contains the flag variation key and version. Do not pass the raw token to untrusted clients.

    Parameters

    • token: string

      URL-safe Base64-encoded token produced by LDGraphTrackerImpl.resumptionToken.

    • ldClient: LDClientMin

      LaunchDarkly client instance.

    • context: LDContext

      LDContext for the new tracker.

    Returns LDGraphTrackerImpl

Generated using TypeDoc