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
| agent |
Set the agent AUID baggage value. |
| agent |
Set the agent blueprint ID baggage value. |
| agent |
Set the agent description baggage value. |
| agent |
Set the agent email baggage value. |
| agent |
Set the agent ID baggage value. |
| agent |
Set the agent name baggage value. |
| agent |
Set the agent platform ID baggage value. |
| agent |
Set the agent version baggage value. |
| build() | Apply the collected baggage to the current context. |
| caller |
Set the caller agent platform ID baggage value. |
| caller |
Set the caller client IP baggage value. |
| channel |
Set the channel link/URL. |
| channel |
Set the channel name (e.g., Teams, Slack). |
| conversation |
Set the conversation ID baggage value. |
| conversation |
Set the conversation item link baggage value. |
| invoke |
Sets the invoke agent server address and port baggage values. |
| operation |
Set the operation source baggage value (e.g., ATG, ACF). |
| session |
Set the session description baggage value. |
| session |
Set the session ID baggage value. |
| set |
Set multiple baggage pairs from a dictionary or iterable. |
| set |
Convenience method to begin a request baggage scope with common fields. |
| tenant |
Set the tenant ID baggage value. |
| user |
Set the user email baggage value. |
| user |
Set the user ID baggage value. |
| user |
Set the user name baggage value. |
Method Details
agentAuid(string | null | undefined)
Set the agent AUID baggage value.
function agentAuid(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
agentBlueprintId(string | null | undefined)
Set the agent blueprint ID baggage value.
function agentBlueprintId(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
agentDescription(string | null | undefined)
Set the agent description baggage value.
function agentDescription(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
agentEmail(string | null | undefined)
Set the agent email baggage value.
function agentEmail(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
agentId(string | null | undefined)
Set the agent ID baggage value.
function agentId(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
agentName(string | null | undefined)
Set the agent name baggage value.
function agentName(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
agentPlatformId(string | null | undefined)
Set the agent platform ID baggage value.
function agentPlatformId(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
agentVersion(string | null | undefined)
Set the agent version baggage value.
function agentVersion(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
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(string | null | undefined)
Set the caller agent platform ID baggage value.
function callerAgentPlatformId(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
callerClientIp(string | null | undefined)
Set the caller client IP baggage value.
function callerClientIp(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
channelLink(string | null | undefined)
Set the channel link/URL.
function channelLink(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
channelName(string | null | undefined)
Set the channel name (e.g., Teams, Slack).
function channelName(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
conversationId(string | null | undefined)
Set the conversation ID baggage value.
function conversationId(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
conversationItemLink(string | null | undefined)
Set the conversation item link baggage value.
function conversationItemLink(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
invokeAgentServer(string | null | undefined, number)
Sets the invoke agent server address and port baggage values.
function invokeAgentServer(address: string | null | undefined, port?: number): BaggageBuilder
Parameters
- address
-
string | null | undefined
The server address (hostname) of the target agent service.
- port
-
number
Optional server port. Only recorded when different from 443.
Returns
operationSource(string | null | undefined)
Set the operation source baggage value (e.g., ATG, ACF).
function operationSource(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
sessionDescription(string | null | undefined)
Set the session description baggage value.
function sessionDescription(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
sessionId(string)
Set the session ID baggage value.
function sessionId(value: string): BaggageBuilder
Parameters
- value
-
string
Returns
setPairs(Record<string, any> | Iterable<[string, any], any, any> | null | undefined)
Set multiple baggage pairs from a dictionary or iterable.
function setPairs(pairs: Record<string, any> | Iterable<[string, any], any, any> | null | undefined): BaggageBuilder
Parameters
- pairs
-
Record<string, any> | Iterable<[string, any], any, any> | null | undefined
Dictionary or iterable of key-value pairs
Returns
setRequestContext(string | null, string | null)
Convenience method to begin a request baggage scope with common fields.
static function setRequestContext(tenantId?: string | null, agentId?: string | null): BaggageScope
Parameters
- tenantId
-
string | null
The tenant ID
- agentId
-
string | null
The agent ID
Returns
A BaggageScope with tenant and agent ID set
tenantId(string | null | undefined)
Set the tenant ID baggage value.
function tenantId(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
userEmail(string | null | undefined)
Set the user email baggage value.
function userEmail(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
userId(string | null | undefined)
Set the user ID baggage value.
function userId(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined
Returns
userName(string | null | undefined)
Set the user name baggage value.
function userName(value: string | null | undefined): BaggageBuilder
Parameters
- value
-
string | null | undefined