Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/agents-a365-observability/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"scripts": {
"prebuild": "node -p \"'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prebuild script generates version.ts without a copyright header. Since the generated file is checked into the repository, the generator should include the Microsoft copyright header. Update the script to prepend the copyright comment before the export statement.

Copilot generated this review using guidance from repository custom instructions.
"build:cjs": "npx tsc --project tsconfig.cjs.json",
"build:esm": "npx tsc --project tsconfig.esm.json",
"build": "npm run build:cjs && npm run build:esm",
Expand Down
57 changes: 36 additions & 21 deletions packages/agents-a365-observability/src/tracing/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// ------------------------------------------------------------------------------

import { LIB_VERSION } from '../version';

/**
* OpenTelemetry constants for Agent 365
*/
export class OpenTelemetryConstants {
// New telemetry schema feature flag
public static readonly USE_NEW_TELEMETRY_SCHEMA_ENV = 'A365_USE_NEW_TELEMETRY_SCHEMA';
// eslint-disable-next-line no-restricted-properties
public static readonly isNewTelemetrySchemaEnabled = process.env['A365_USE_NEW_TELEMETRY_SCHEMA'] === 'true';

// Span operation names
public static readonly INVOKE_AGENT_OPERATION_NAME = 'invoke_agent';
public static readonly EXECUTE_TOOL_OPERATION_NAME = 'execute_tool';
Expand Down Expand Up @@ -46,9 +53,10 @@ export class OpenTelemetryConstants {
public static readonly GEN_AI_AGENT_NAME_KEY = 'gen_ai.agent.name';
public static readonly GEN_AI_AGENT_TYPE_KEY = 'gen_ai.agent.type';
public static readonly GEN_AI_AGENT_DESCRIPTION_KEY = 'gen_ai.agent.description';
public static readonly GEN_AI_AGENT_PLATFORM_ID_KEY = 'gen_ai.agent.platformid';
public static readonly GEN_AI_AGENT_PLATFORM_ID_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.a365.agent.platform.id' : 'gen_ai.agent.platformid';
public static readonly GEN_AI_AGENT_THOUGHT_PROCESS_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.a365.agent.thought.process' : 'gen_ai.agent.thought.process';
public static readonly GEN_AI_CONVERSATION_ID_KEY = 'gen_ai.conversation.id';
public static readonly GEN_AI_CONVERSATION_ITEM_LINK_KEY = 'gen_ai.conversation.item.link';
public static readonly GEN_AI_CONVERSATION_ITEM_LINK_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.conversation.item.link' : 'gen_ai.conversation.item.link';
public static readonly GEN_AI_TOKEN_TYPE_KEY = 'gen_ai.token.type';
public static readonly GEN_AI_USAGE_INPUT_TOKENS_KEY = 'gen_ai.usage.input_tokens';
public static readonly GEN_AI_USAGE_OUTPUT_TOKENS_KEY = 'gen_ai.usage.output_tokens';
Expand All @@ -69,36 +77,35 @@ export class OpenTelemetryConstants {
public static readonly GEN_AI_TOOL_TYPE_KEY = 'gen_ai.tool.type';

// Agent user (user tied to agent instance during creation) or caller dimensions
public static readonly GEN_AI_AGENT_USER_ID_KEY = 'gen_ai.agent.userid';
public static readonly GEN_AI_CALLER_ID_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.caller.id' : 'gen_ai.caller.id';
public static readonly GEN_AI_CALLER_NAME_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.caller.name' : 'gen_ai.caller.name';
public static readonly GEN_AI_CALLER_UPN_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.caller.upn' : 'gen_ai.caller.upn';
public static readonly GEN_AI_CALLER_CLIENT_IP_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'client.address' : 'gen_ai.caller.client.ip';
public static readonly GEN_AI_CALLER_TENANT_ID_KEY = 'gen_ai.caller.tenantid';
public static readonly GEN_AI_CALLER_ID_KEY = 'gen_ai.caller.id';
public static readonly GEN_AI_CALLER_NAME_KEY = 'gen_ai.caller.name';
public static readonly GEN_AI_CALLER_UPN_KEY = 'gen_ai.caller.upn';
public static readonly GEN_AI_CALLER_CLIENT_IP_KEY = 'gen_ai.caller.client.ip';

// Agent to Agent caller agent dimensions
public static readonly GEN_AI_CALLER_AGENT_USER_ID_KEY = 'gen_ai.caller.agent.userid';
public static readonly GEN_AI_CALLER_AGENT_USER_ID_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.a365.caller.agent.user.id' : 'gen_ai.caller.agent.userid';
public static readonly GEN_AI_CALLER_AGENT_UPN_KEY = 'gen_ai.caller.agent.upn';
public static readonly GEN_AI_CALLER_AGENT_TENANT_ID_KEY = 'gen_ai.caller.agent.tenantid';
Comment on lines 88 to 89
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GEN_AI_CALLER_AGENT_UPN_KEY and GEN_AI_CALLER_AGENT_TENANT_ID_KEY are not schema-switched to the new microsoft.* namespace when isNewTelemetrySchemaEnabled is true, unlike other caller agent attributes (GEN_AI_CALLER_AGENT_ID_KEY, GEN_AI_CALLER_AGENT_NAME_KEY, etc.). This creates inconsistent attribute naming when the new schema is enabled. Consider adding conditional mapping for these keys similar to lines 88, 91-94, and 96.

Suggested change
public static readonly GEN_AI_CALLER_AGENT_UPN_KEY = 'gen_ai.caller.agent.upn';
public static readonly GEN_AI_CALLER_AGENT_TENANT_ID_KEY = 'gen_ai.caller.agent.tenantid';
public static readonly GEN_AI_CALLER_AGENT_UPN_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.a365.caller.agent.upn' : 'gen_ai.caller.agent.upn';
public static readonly GEN_AI_CALLER_AGENT_TENANT_ID_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.a365.caller.agent.tenant.id' : 'gen_ai.caller.agent.tenantid';

Copilot uses AI. Check for mistakes.
public static readonly GEN_AI_CALLER_AGENT_NAME_KEY = 'gen_ai.caller.agent.name';
public static readonly GEN_AI_CALLER_AGENT_ID_KEY = 'gen_ai.caller.agent.id';
public static readonly GEN_AI_CALLER_AGENT_TYPE_KEY = 'gen_ai.caller.agent.type';
public static readonly GEN_AI_CALLER_AGENT_APPLICATION_ID_KEY = 'gen_ai.caller.agent.applicationid';
public static readonly GEN_AI_CALLER_AGENT_NAME_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.a365.caller.agent.name' : 'gen_ai.caller.agent.name';
public static readonly GEN_AI_CALLER_AGENT_ID_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.a365.caller.agent.id' : 'gen_ai.caller.agent.id';
public static readonly GEN_AI_CALLER_AGENT_TYPE_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.a365.caller.agent.type' : 'gen_ai.caller.agent.type';
public static readonly GEN_AI_CALLER_AGENT_APPLICATION_ID_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.a365.caller.agent.blueprint.id' : 'gen_ai.caller.agent.applicationid';
public static readonly GEN_AI_CALLER_AGENT_CLIENT_IP_KEY = 'gen_ai.caller.agent.user.client.ip';
Comment on lines 88 to 94
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The caller agent attributes GEN_AI_CALLER_AGENT_UPN_KEY, GEN_AI_CALLER_AGENT_TENANT_ID_KEY, and GEN_AI_CALLER_AGENT_CLIENT_IP_KEY are not updated to use the new microsoft.* namespace when isNewTelemetrySchemaEnabled is true, unlike other caller agent dimensions (name, id, type, application_id, platform_id). This creates inconsistency where some caller agent attributes use the new schema while others remain in the old gen_ai.* namespace. Consider adding conditional mappings for these attributes to maintain consistency across the schema.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GEN_AI_CALLER_AGENT_CLIENT_IP_KEY is not schema-switched to the new namespace when isNewTelemetrySchemaEnabled is true, unlike other caller agent attributes. For consistency with the regular caller's client IP mapping (line 84: gen_ai.caller.client.ip → client.address), this should also be mapped to the appropriate new schema attribute name.

Suggested change
public static readonly GEN_AI_CALLER_AGENT_CLIENT_IP_KEY = 'gen_ai.caller.agent.user.client.ip';
public static readonly GEN_AI_CALLER_AGENT_CLIENT_IP_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'client.address' : 'gen_ai.caller.agent.user.client.ip';

Copilot uses AI. Check for mistakes.
public static readonly GEN_AI_CALLER_AGENT_PLATFORM_ID_KEY = 'gen_ai.caller.agent.platformid';
public static readonly GEN_AI_CALLER_AGENT_PLATFORM_ID_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.a365.caller.agent.platform.id' : 'gen_ai.caller.agent.platformid';
// Agent-specific dimensions
public static readonly AGENT_ID_KEY = 'gen_ai.agent.id';
public static readonly GEN_AI_TASK_ID_KEY = 'gen_ai.task.id';
public static readonly SESSION_ID_KEY = 'session.id';
public static readonly SESSION_DESCRIPTION_KEY = 'session.description';
public static readonly SESSION_ID_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.session.id' : 'session.id';
public static readonly SESSION_DESCRIPTION_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.session.description' : 'session.description';
public static readonly GEN_AI_ICON_URI_KEY = 'gen_ai.agent365.icon_uri';
public static readonly TENANT_ID_KEY = 'tenant.id';
public static readonly TENANT_ID_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.tenant.id' : 'tenant.id';

// Baggage keys
public static readonly OPERATION_SOURCE_KEY = 'operation.source';
public static readonly GEN_AI_AGENT_AUID_KEY = 'gen_ai.agent.user.id';
public static readonly GEN_AI_AGENT_UPN_KEY = 'gen_ai.agent.upn';
public static readonly GEN_AI_AGENT_BLUEPRINT_ID_KEY = 'gen_ai.agent.applicationid';
public static readonly GEN_AI_AGENT_AUID_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.a365.agent.user.id' : 'gen_ai.agent.user.id';
public static readonly GEN_AI_AGENT_UPN_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.agent.user.upn' : 'gen_ai.agent.upn';
public static readonly GEN_AI_AGENT_BLUEPRINT_ID_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.agent.blueprint.id' : 'gen_ai.agent.applicationid';
public static readonly CORRELATION_ID_KEY = 'correlation.id';
public static readonly HIRING_MANAGER_ID_KEY = 'hiring.manager.id';

Expand All @@ -108,12 +115,20 @@ export class OpenTelemetryConstants {

// Source metadata dimensions
public static readonly GEN_AI_EXECUTION_SOURCE_ID_KEY = 'gen_ai.execution.sourceMetadata.id';
public static readonly GEN_AI_EXECUTION_SOURCE_NAME_KEY = 'gen_ai.channel.name';
public static readonly GEN_AI_EXECUTION_SOURCE_DESCRIPTION_KEY = 'gen_ai.channel.link';
public static readonly GEN_AI_EXECUTION_SOURCE_NAME_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.channel.name' : 'gen_ai.channel.name';
public static readonly GEN_AI_EXECUTION_SOURCE_DESCRIPTION_KEY = OpenTelemetryConstants.isNewTelemetrySchemaEnabled ? 'microsoft.channel.link' : 'gen_ai.channel.link';

// Custom parent id and parent name key
public static readonly CUSTOM_PARENT_SPAN_ID_KEY = 'custom.parent.span.id';
public static readonly CUSTOM_SPAN_NAME_KEY = 'custom.span.name';

// Telemetry SDK attributes (replace operation.source when isNewTelemetrySchemaEnabled)
public static readonly TELEMETRY_SDK_NAME_KEY = 'telemetry.sdk.name';
public static readonly TELEMETRY_SDK_LANGUAGE_KEY = 'telemetry.sdk.language';
public static readonly TELEMETRY_SDK_VERSION_KEY = 'telemetry.sdk.version';
public static readonly TELEMETRY_SDK_NAME_VALUE = 'Agent365Sdk';
public static readonly TELEMETRY_SDK_LANGUAGE_VALUE = 'nodejs';
public static readonly TELEMETRY_SDK_VERSION_VALUE = LIB_VERSION;
}

/**
Expand Down
3 changes: 3 additions & 0 deletions packages/agents-a365-observability/src/tracing/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ export interface InferenceDetails {

/** Response ID from the model provider */
responseId?: string;

/** The thought process used by the agent */
thoughtProcess?: string;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ export class BaggageBuilder {
* @returns Self for method chaining
*/
correlationId(value: string | null | undefined): BaggageBuilder {
this.set(OpenTelemetryConstants.CORRELATION_ID_KEY, value);
if (!OpenTelemetryConstants.isNewTelemetrySchemaEnabled) {
this.set(OpenTelemetryConstants.CORRELATION_ID_KEY, value);
}
return this;
}

Expand Down Expand Up @@ -125,7 +127,9 @@ export class BaggageBuilder {
* @returns Self for method chaining
*/
hiringManagerId(value: string | null | undefined): BaggageBuilder {
this.set(OpenTelemetryConstants.HIRING_MANAGER_ID_KEY, value);
if (!OpenTelemetryConstants.isNewTelemetrySchemaEnabled) {
this.set(OpenTelemetryConstants.HIRING_MANAGER_ID_KEY, value);
}
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,18 @@ export class SpanProcessor implements BaseSpanProcessor {
INVOKE_AGENT_ATTRIBUTES.forEach(key => targetKeys.add(key));
}

// Set operation source - coalesce baggage value with SDK default
if (!existingAttrs.has(OpenTelemetryConstants.OPERATION_SOURCE_KEY)) {
// Set operation source or telemetry SDK attributes
if (OpenTelemetryConstants.isNewTelemetrySchemaEnabled) {
if (!existingAttrs.has(OpenTelemetryConstants.TELEMETRY_SDK_NAME_KEY)) {
span.setAttribute(OpenTelemetryConstants.TELEMETRY_SDK_NAME_KEY, OpenTelemetryConstants.TELEMETRY_SDK_NAME_VALUE);
}
if (!existingAttrs.has(OpenTelemetryConstants.TELEMETRY_SDK_LANGUAGE_KEY)) {
span.setAttribute(OpenTelemetryConstants.TELEMETRY_SDK_LANGUAGE_KEY, OpenTelemetryConstants.TELEMETRY_SDK_LANGUAGE_VALUE);
}
if (!existingAttrs.has(OpenTelemetryConstants.TELEMETRY_SDK_VERSION_KEY)) {
span.setAttribute(OpenTelemetryConstants.TELEMETRY_SDK_VERSION_KEY, OpenTelemetryConstants.TELEMETRY_SDK_VERSION_VALUE);
}
} else if (!existingAttrs.has(OpenTelemetryConstants.OPERATION_SOURCE_KEY)) {
const operationSource =
baggageMap.get(OpenTelemetryConstants.OPERATION_SOURCE_KEY) ||
OperationSource.SDK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@ export const GENERIC_ATTRIBUTES: readonly string[] = [
consts.TENANT_ID_KEY,
consts.CUSTOM_PARENT_SPAN_ID_KEY,
consts.CUSTOM_SPAN_NAME_KEY,
consts.CORRELATION_ID_KEY,
...(consts.isNewTelemetrySchemaEnabled ? [] : [consts.CORRELATION_ID_KEY]),
consts.SESSION_ID_KEY,
consts.GEN_AI_CONVERSATION_ID_KEY,
consts.GEN_AI_CONVERSATION_ITEM_LINK_KEY,
consts.GEN_AI_OPERATION_NAME_KEY,
consts.GEN_AI_AGENT_ID_KEY,
consts.GEN_AI_AGENT_NAME_KEY,
consts.GEN_AI_AGENT_TYPE_KEY,
...(consts.isNewTelemetrySchemaEnabled ? [] : [consts.GEN_AI_AGENT_TYPE_KEY]),
consts.GEN_AI_AGENT_DESCRIPTION_KEY,
consts.SESSION_DESCRIPTION_KEY,
consts.GEN_AI_AGENT_USER_ID_KEY,
consts.GEN_AI_AGENT_UPN_KEY,
consts.GEN_AI_AGENT_BLUEPRINT_ID_KEY,
...(consts.isNewTelemetrySchemaEnabled ? [] : [consts.GEN_AI_AGENT_BLUEPRINT_ID_KEY]),
consts.GEN_AI_AGENT_AUID_KEY,
consts.GEN_AI_AGENT_PLATFORM_ID_KEY,
];
Expand All @@ -36,8 +35,8 @@ export const INVOKE_AGENT_ATTRIBUTES: readonly string[] = [
consts.GEN_AI_CALLER_ID_KEY,
consts.GEN_AI_CALLER_NAME_KEY,
consts.GEN_AI_CALLER_UPN_KEY,
consts.GEN_AI_CALLER_TENANT_ID_KEY,
consts.GEN_AI_CALLER_CLIENT_IP_KEY,
consts.GEN_AI_CALLER_TENANT_ID_KEY,
// Caller Agent (A2A) attributes
consts.GEN_AI_CALLER_AGENT_ID_KEY,
consts.GEN_AI_CALLER_AGENT_NAME_KEY,
Expand All @@ -49,8 +48,10 @@ export const INVOKE_AGENT_ATTRIBUTES: readonly string[] = [
consts.GEN_AI_CALLER_AGENT_CLIENT_IP_KEY,
consts.GEN_AI_CALLER_AGENT_PLATFORM_ID_KEY,
// Execution context
consts.GEN_AI_EXECUTION_TYPE_KEY,
...(consts.isNewTelemetrySchemaEnabled ? [] : [consts.GEN_AI_EXECUTION_TYPE_KEY]),
consts.GEN_AI_EXECUTION_SOURCE_ID_KEY,
consts.GEN_AI_EXECUTION_SOURCE_NAME_KEY,
consts.GEN_AI_EXECUTION_SOURCE_DESCRIPTION_KEY,
// New schema: agent type and blueprint ID are InvokeAgent-only
...(consts.isNewTelemetrySchemaEnabled ? [consts.GEN_AI_AGENT_TYPE_KEY, consts.GEN_AI_AGENT_BLUEPRINT_ID_KEY] : []),
];
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { SpanKind, TimeInput } from '@opentelemetry/api';
import { OpenTelemetryScope } from './OpenTelemetryScope';
import { ToolCallDetails, AgentDetails, TenantDetails, SourceMetadata } from '../contracts';
import { ToolCallDetails, AgentDetails, TenantDetails, SourceMetadata, CallerDetails } from '../contracts';
import { ParentContext } from '../context/trace-context-propagation';
import { OpenTelemetryConstants } from '../constants';

Expand All @@ -24,6 +24,7 @@ export class ExecuteToolScope extends OpenTelemetryScope {
* tool call after execution has already completed.
* @param endTime Optional explicit end time (ms epoch, Date, or HrTime). When provided, the span will
* use this timestamp when disposed instead of the current wall-clock time.
* @param callerDetails Optional caller details.
* @returns A new ExecuteToolScope instance.
*/
public static start(
Expand All @@ -34,9 +35,10 @@ export class ExecuteToolScope extends OpenTelemetryScope {
sourceMetadata?: Pick<SourceMetadata, "name" | "description">,
parentContext?: ParentContext,
startTime?: TimeInput,
endTime?: TimeInput
endTime?: TimeInput,
callerDetails?: CallerDetails
): ExecuteToolScope {
return new ExecuteToolScope(details, agentDetails, tenantDetails, conversationId, sourceMetadata, parentContext, startTime, endTime);
return new ExecuteToolScope(details, agentDetails, tenantDetails, conversationId, sourceMetadata, parentContext, startTime, endTime, callerDetails);
}

private constructor(
Expand All @@ -47,7 +49,8 @@ export class ExecuteToolScope extends OpenTelemetryScope {
sourceMetadata?: Pick<SourceMetadata, "name" | "description">,
parentContext?: ParentContext,
startTime?: TimeInput,
endTime?: TimeInput
endTime?: TimeInput,
callerDetails?: CallerDetails
) {
super(
SpanKind.INTERNAL,
Expand All @@ -57,7 +60,8 @@ export class ExecuteToolScope extends OpenTelemetryScope {
tenantDetails,
parentContext,
startTime,
endTime
endTime,
callerDetails
);

// Destructure the details object to match C# pattern
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
InferenceDetails,
AgentDetails,
TenantDetails,
SourceMetadata
SourceMetadata,
CallerDetails
} from '../contracts';
import { ParentContext } from '../context/trace-context-propagation';

Expand All @@ -27,6 +28,7 @@ export class InferenceScope extends OpenTelemetryScope {
* Accepts a ParentSpanRef (manual traceId/spanId) or an OTel Context (e.g. from extractTraceContext).
* @param startTime Optional explicit start time (ms epoch, Date, or HrTime).
* @param endTime Optional explicit end time (ms epoch, Date, or HrTime).
* @param callerDetails Optional caller details.
* @returns A new InferenceScope instance
*/
public static start(
Expand All @@ -37,9 +39,10 @@ export class InferenceScope extends OpenTelemetryScope {
sourceMetadata?: Pick<SourceMetadata, "name" | "description">,
parentContext?: ParentContext,
startTime?: TimeInput,
endTime?: TimeInput
endTime?: TimeInput,
callerDetails?: CallerDetails
): InferenceScope {
return new InferenceScope(details, agentDetails, tenantDetails, conversationId, sourceMetadata, parentContext, startTime, endTime);
return new InferenceScope(details, agentDetails, tenantDetails, conversationId, sourceMetadata, parentContext, startTime, endTime, callerDetails);
}

private constructor(
Expand All @@ -50,7 +53,8 @@ export class InferenceScope extends OpenTelemetryScope {
sourceMetadata?: Pick<SourceMetadata, "name" | "description">,
parentContext?: ParentContext,
startTime?: TimeInput,
endTime?: TimeInput
endTime?: TimeInput,
callerDetails?: CallerDetails
) {
super(
SpanKind.CLIENT,
Expand All @@ -60,7 +64,8 @@ export class InferenceScope extends OpenTelemetryScope {
tenantDetails,
parentContext,
startTime,
endTime
endTime,
callerDetails
);

// Set core inference information matching C# implementation
Expand All @@ -71,9 +76,10 @@ export class InferenceScope extends OpenTelemetryScope {
this.setTagMaybe(OpenTelemetryConstants.GEN_AI_USAGE_OUTPUT_TOKENS_KEY, details.outputTokens?.toString());
this.setTagMaybe(OpenTelemetryConstants.GEN_AI_RESPONSE_FINISH_REASONS_KEY, details.finishReasons?.join(','));
this.setTagMaybe(OpenTelemetryConstants.GEN_AI_RESPONSE_ID_KEY, details.responseId);
this.setTagMaybe(OpenTelemetryConstants.GEN_AI_AGENT_THOUGHT_PROCESS_KEY, details.thoughtProcess);
this.setTagMaybe(OpenTelemetryConstants.GEN_AI_CONVERSATION_ID_KEY, conversationId);
this.setTagMaybe(OpenTelemetryConstants.GEN_AI_EXECUTION_SOURCE_NAME_KEY, sourceMetadata?.name);
this.setTagMaybe(OpenTelemetryConstants.GEN_AI_EXECUTION_SOURCE_DESCRIPTION_KEY, sourceMetadata?.description);
this.setTagMaybe(OpenTelemetryConstants.GEN_AI_EXECUTION_SOURCE_DESCRIPTION_KEY, sourceMetadata?.description);
}

/**
Expand Down
Loading