BaggageBuilder class

Fluent builder for setting OpenTelemetry baggage values.

Example

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

scope.run(() => {
  // Baggage is active in this context
});

Methods

agentAuid(undefined | null | string)

Set the agent AUID baggage value.

agentBlueprintId(undefined | null | string)

Set the agent blueprint ID baggage value.

agentDescription(undefined | null | string)

Set the agent description baggage value.

agentEmail(undefined | null | string)

Set the agent email baggage value.

agentId(undefined | null | string)

Set the agent ID baggage value.

agentName(undefined | null | string)

Set the agent name baggage value.

agentPlatformId(undefined | null | string)

Set the agent platform ID baggage value.

agentVersion(undefined | null | string)

Set the agent version baggage value.

build()

Apply the collected baggage to the current context.

callerAgentPlatformId(undefined | null | string)

Set the caller agent platform ID baggage value.

callerClientIp(undefined | null | string)

Set the caller client IP baggage value.

channelLink(undefined | null | string)

Set the channel link/URL.

channelName(undefined | null | string)

Set the channel name (e.g., Teams, Slack).

conversationId(undefined | null | string)

Set the conversation ID baggage value.

conversationItemLink(undefined | null | string)

Set the conversation item link baggage value.

invokeAgentServer(undefined | null | string, number)

Sets the invoke agent server address and port baggage values.

operationSource(undefined | null | string)

Set the operation source baggage value (e.g., ATG, ACF).

sessionDescription(undefined | null | string)

Set the session description baggage value.

sessionId(string)

Set the session ID baggage value.

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

Set multiple baggage pairs from a dictionary or iterable.

setRequestContext(null | string, null | string)

Convenience method to begin a request baggage scope with common fields.

tenantId(undefined | null | string)

Set the tenant ID baggage value.

userEmail(undefined | null | string)

Set the user email baggage value.

userId(undefined | null | string)

Set the user ID baggage value.

userName(undefined | null | string)

Set the user name baggage value.

Method Details

agentAuid(undefined | null | string)

Set the agent AUID baggage value.

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

Parameters

value

undefined | null | string

Returns

agentBlueprintId(undefined | null | string)

Set the agent blueprint ID baggage value.

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

Parameters

value

undefined | null | string

Returns

agentDescription(undefined | null | string)

Set the agent description baggage value.

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

Parameters

value

undefined | null | string

Returns

agentEmail(undefined | null | string)

Set the agent email baggage value.

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

Parameters

value

undefined | null | string

Returns

agentId(undefined | null | string)

Set the agent ID baggage value.

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

Parameters

value

undefined | null | string

Returns

agentName(undefined | null | string)

Set the agent name baggage value.

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

Parameters

value

undefined | null | string

Returns

agentPlatformId(undefined | null | string)

Set the agent platform ID baggage value.

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

Parameters

value

undefined | null | string

Returns

agentVersion(undefined | null | string)

Set the agent version baggage value.

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

Parameters

value

undefined | null | string

Returns

build()

Apply the collected baggage to the current context.

function build(): BaggageScope

Returns

A BaggageScope that can run callbacks under the baggage context

callerAgentPlatformId(undefined | null | string)

Set the caller agent platform ID baggage value.

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

Parameters

value

undefined | null | string

Returns

callerClientIp(undefined | null | string)

Set the caller client IP baggage value.

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

Parameters

value

undefined | null | string

Returns

Set the channel link/URL.

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

Parameters

value

undefined | null | string

Returns

channelName(undefined | null | string)

Set the channel name (e.g., Teams, Slack).

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

Parameters

value

undefined | null | string

Returns

conversationId(undefined | null | string)

Set the conversation ID baggage value.

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

Parameters

value

undefined | null | string

Returns

Set the conversation item link baggage value.

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

Parameters

value

undefined | null | string

Returns

invokeAgentServer(undefined | null | string, number)

Sets the invoke agent server address and port baggage values.

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

Parameters

address

undefined | null | string

The server address (hostname) of the target agent service.

port

number

Optional server port. Only recorded when different from 443.

Returns

operationSource(undefined | null | string)

Set the operation source baggage value (e.g., ATG, ACF).

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

Parameters

value

undefined | null | string

Returns

sessionDescription(undefined | null | string)

Set the session description baggage value.

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

Parameters

value

undefined | null | string

Returns

sessionId(string)

Set the session ID baggage value.

function sessionId(value: string): BaggageBuilder

Parameters

value

string

Returns

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

Set multiple baggage pairs from a dictionary or iterable.

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

Parameters

pairs

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

Dictionary or iterable of key-value pairs

Returns

setRequestContext(null | string, null | string)

Convenience method to begin a request baggage scope with common fields.

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

Parameters

tenantId

null | string

The tenant ID

agentId

null | string

The agent ID

Returns

A BaggageScope with tenant and agent ID set

tenantId(undefined | null | string)

Set the tenant ID baggage value.

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

Parameters

value

undefined | null | string

Returns

userEmail(undefined | null | string)

Set the user email baggage value.

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

Parameters

value

undefined | null | string

Returns

userId(undefined | null | string)

Set the user ID baggage value.

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

Parameters

value

undefined | null | string

Returns

userName(undefined | null | string)

Set the user name baggage value.

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

Parameters

value

undefined | null | string

Returns