-
Notifications
You must be signed in to change notification settings - Fork 5
Support new telemetry schema attribute names #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7564849
c79dd4f
f3fdb15
64c28a7
00cd584
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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'; | ||||||||||
fpfp100 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
|
|
||||||||||
| // Span operation names | ||||||||||
| public static readonly INVOKE_AGENT_OPERATION_NAME = 'invoke_agent'; | ||||||||||
| public static readonly EXECUTE_TOOL_OPERATION_NAME = 'execute_tool'; | ||||||||||
|
|
@@ -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'; | ||||||||||
|
|
@@ -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
|
||||||||||
| 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
AI
Feb 19, 2026
There was a problem hiding this comment.
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
AI
Feb 19, 2026
There was a problem hiding this comment.
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.
| 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'; |
There was a problem hiding this comment.
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.