BaggageBuilder class

根據請求提供 OpenTelemetry 上下文傳播的行李建構器。

此類別提供流暢的 API 來設定行李值,這些值將在 OpenTelemetry 情境中傳播。

範例

const scope = new BaggageBuilder()
  .tenantId("tenant-123")
  .agentId("agent-456")
  .build();

scope.enter();
// Baggage is set in this context
// ... do work ...
scope.exit();
// Baggage is restored after exiting the context

方法

agentAuid(undefined | null | string)

設定客服AUID行李值。

agentBlueprintId(undefined | null | string)

設定特務藍圖的 ID 行李值。

agentDescription(undefined | null | string)

設定代理人描述的行李值。

agentEmail(undefined | null | string)

設定代理人電子郵件行李值。

agentId(undefined | null | string)

設定特務ID行李值。

agentName(undefined | null | string)

設定代理人姓名、行李價值。

agentPlatformId(undefined | null | string)

設定代理平台 ID 行李值。

agentVersion(undefined | null | string)

設定代理版本的行李值。

build()

將收集到的包袱應用於當前情境。

callerAgentPlatformId(undefined | null | string)

設定來電代理平台 ID 行李值。

callerClientIp(undefined | null | string)

設定來電者客戶端的 IP 行李值。 用於擷取請求的原始用戶端 IP,以便透過 OpenTelemetry 包式傳輸。

channelLink(undefined | null | string)

設定頻道連結/網址。

channelName(undefined | null | string)

設定頻道名稱(例如 Teams、Slack)。

conversationId(undefined | null | string)

設定對話 ID 的行李值。

conversationItemLink(undefined | null | string)

設定對話項目連結行李值。

invokeAgentServer(undefined | null | string, number)

設定 invoke agent 伺服器位址及埠行李值。

operationSource(undefined | null | string)

設定操作來源的行李值。 用於伺服器區間以識別服務(例如 ATG、ACF)。

sessionDescription(undefined | null | string)

設定會話描述的行李值。

sessionId(string)

設定會話 ID 行李值。

setPairs(undefined | null | Record<string, any> | Iterable<[string, any]>)

從字典或可迭代中設定多對行李。

setRequestContext(null | string, null | string)

方便地開始使用常見欄位的行李範圍請求。

tenantId(undefined | null | string)

設定租戶身份證行李值。

userEmail(undefined | null | string)

設定使用者電子郵件行李值。

userId(undefined | null | string)

設定使用者 ID 行李值。

userName(undefined | null | string)

設定使用者名稱的行李值。

方法詳細資料

agentAuid(undefined | null | string)

設定客服AUID行李值。

function agentAuid(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

代理AUID

傳回

用於方法鏈結的 Self

agentBlueprintId(undefined | null | string)

設定特務藍圖的 ID 行李值。

function agentBlueprintId(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

代理藍圖 ID

傳回

用於方法鏈結的 Self

agentDescription(undefined | null | string)

設定代理人描述的行李值。

function agentDescription(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

代理人描述

傳回

用於方法鏈結的 Self

agentEmail(undefined | null | string)

設定代理人電子郵件行李值。

function agentEmail(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

代理人的電子郵件

傳回

用於方法鏈結的 Self

agentId(undefined | null | string)

設定特務ID行李值。

function agentId(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

代理程式 ID

傳回

用於方法鏈結的 Self

agentName(undefined | null | string)

設定代理人姓名、行李價值。

function agentName(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

代理程式名稱

傳回

用於方法鏈結的 Self

agentPlatformId(undefined | null | string)

設定代理平台 ID 行李值。

function agentPlatformId(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

代理平台識別碼

傳回

用於方法鏈結的 Self

agentVersion(undefined | null | string)

設定代理版本的行李值。

function agentVersion(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

代理版本(例如,'1.0.0', '2025-05-01')

傳回

用於方法鏈結的 Self

build()

將收集到的包袱應用於當前情境。

function build(): BaggageScope

傳回

一個情境管理器,能在離開時還原之前的包袱

callerAgentPlatformId(undefined | null | string)

設定來電代理平台 ID 行李值。

function callerAgentPlatformId(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

來電代理平台識別碼

傳回

用於方法鏈結的 Self

callerClientIp(undefined | null | string)

設定來電者客戶端的 IP 行李值。 用於擷取請求的原始用戶端 IP,以便透過 OpenTelemetry 包式傳輸。

function callerClientIp(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

來電者客戶端的 IP 位址

傳回

用於方法鏈結的 Self

設定頻道連結/網址。

function channelLink(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

頻道連結

傳回

用於方法鏈結的 Self

channelName(undefined | null | string)

設定頻道名稱(例如 Teams、Slack)。

function channelName(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

通道名稱

傳回

用於方法鏈結的 Self

conversationId(undefined | null | string)

設定對話 ID 的行李值。

function conversationId(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

對話識別碼

傳回

用於方法鏈結的 Self

設定對話項目連結行李值。

function conversationItemLink(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

對話項目連結

傳回

用於方法鏈結的 Self

invokeAgentServer(undefined | null | string, number)

設定 invoke agent 伺服器位址及埠行李值。

function invokeAgentServer(address: undefined | null | string, port?: number): BaggageBuilder

參數

address

undefined | null | string

目標代理服務的伺服器位址(主機名稱)。

port

number

可選的伺服器埠。 只有在與443不同時才被記錄。

傳回

目前用於方法鏈結的建構實例。

operationSource(undefined | null | string)

設定操作來源的行李值。 用於伺服器區間以識別服務(例如 ATG、ACF)。

function operationSource(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

運算源

傳回

用於方法鏈結的 Self

sessionDescription(undefined | null | string)

設定會話描述的行李值。

function sessionDescription(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

會議說明

傳回

用於方法鏈結的 Self

sessionId(string)

設定會話 ID 行李值。

function sessionId(value: string): BaggageBuilder

參數

value

string

工作階段 ID

傳回

用於方法鏈結的 Self

setPairs(undefined | null | Record<string, any> | Iterable<[string, any]>)

從字典或可迭代中設定多對行李。

function setPairs(pairs: undefined | null | Record<string, any> | Iterable<[string, any]>): BaggageBuilder

參數

pairs

undefined | null | Record<string, any> | Iterable<[string, any]>

字典或鍵值對的迭代

傳回

用於方法鏈結的 Self

setRequestContext(null | string, null | string)

方便地開始使用常見欄位的行李範圍請求。

static function setRequestContext(tenantId?: null | string, agentId?: null | string): BaggageScope

參數

tenantId

null | string

租戶識別碼

agentId

null | string

代理程式 ID

傳回

一個情境管理器,能在離開時還原之前的包袱

tenantId(undefined | null | string)

設定租戶身份證行李值。

function tenantId(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

租戶識別碼

傳回

用於方法鏈結的 Self

userEmail(undefined | null | string)

設定使用者電子郵件行李值。

function userEmail(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

使用者電子郵件

傳回

用於方法鏈結的 Self

userId(undefined | null | string)

設定使用者 ID 行李值。

function userId(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

使用者 ID

傳回

用於方法鏈結的 Self

userName(undefined | null | string)

設定使用者名稱的行李值。

function userName(value: undefined | null | string): BaggageBuilder

參數

value

undefined | null | string

使用者名稱

傳回

用於方法鏈結的 Self