Skip to content

Support new telemetry schema attribute names#207

Open
fpfp100 wants to merge 22 commits intomainfrom
feature/new-telemetry-schema
Open

Support new telemetry schema attribute names#207
fpfp100 wants to merge 22 commits intomainfrom
feature/new-telemetry-schema

Conversation

@fpfp100
Copy link
Contributor

@fpfp100 fpfp100 commented Feb 19, 2026

A365 Telemetry Schema Migration

This PR implements the A365 Observability Schema migration, aligning attribute names with OpenTelemetry semantic conventions and the official Microsoft A365 schema.

Breaking Changes

Human Caller Attributes (Now OTel Standard)

Human caller attributes now use OpenTelemetry standard semantic conventions:

  • GEN_AI_CALLER_ID_KEYUSER_ID_KEY (user.id)
  • GEN_AI_CALLER_NAME_KEYUSER_NAME_KEY (user.name)
  • GEN_AI_CALLER_UPN_KEYUSER_EMAIL_KEY (user.email)
  • GEN_AI_CALLER_CLIENT_IP_KEYCLIENT_ADDRESS_KEY (client.address)

Agent Identity Attributes

Agent attributes now use the microsoft.agent.* namespace:

  • GEN_AI_AGENT_AUID_KEYAGENT_USER_ID_KEY (microsoft.agent.user.id)
  • GEN_AI_AGENT_UPN_KEYAGENT_EMAIL_KEY (microsoft.agent.user.email)
  • GEN_AI_AGENT_BLUEPRINT_ID_KEYAGENT_BLUEPRINT_ID_KEY (microsoft.a365.agent.blueprint.id)

Agent-to-Agent Caller Attributes

Caller agent attributes now use the microsoft.a365.caller.agent.* namespace:

  • GEN_AI_CALLER_AGENT_USER_ID_KEYCALLER_AGENT_USER_ID_KEY (microsoft.a365.caller.agent.user.id)
  • GEN_AI_CALLER_AGENT_UPN_KEYCALLER_AGENT_EMAIL_KEY (microsoft.a365.caller.agent.user.email)
  • GEN_AI_CALLER_AGENT_NAME_KEYCALLER_AGENT_NAME_KEY (microsoft.a365.caller.agent.name)
  • GEN_AI_CALLER_AGENT_ID_KEYCALLER_AGENT_ID_KEY (microsoft.a365.caller.agent.id)
  • GEN_AI_CALLER_AGENT_APPLICATION_ID_KEYCALLER_AGENT_BLUEPRINT_ID_KEY (microsoft.a365.caller.agent.blueprint.id)
  • GEN_AI_CALLER_AGENT_PLATFORM_ID_KEYCALLER_AGENT_PLATFORM_ID_KEY (microsoft.a365.caller.agent.platform.id)

Migration Impact

All code using the old constant names must be updated to use the new names. The attribute values now follow:

  • OTel semantic conventions for human callers (user.*, client.*)
  • Microsoft-specific namespaces for agent attributes (microsoft.agent.*, microsoft.a365.*)

Example Output

Before (Old Schema)

{
  "microsoft.caller.id": "user-123",
  "microsoft.caller.name": "John Doe",
  "microsoft.caller.upn": "john@contoso.com",
  "microsoft.caller.client.ip": "192.168.1.1",
  "gen_ai.agent.auid": "agent-456",
  "gen_ai.agent.upn": "agent@contoso.com"
}

After (New Schema - OTel Standard)

{
  "user.id": "user-123",
  "user.name": "John Doe",
  "user.email": "john@contoso.com",
  "client.address": "192.168.1.1",
  "microsoft.agent.user.id": "agent-456",
  "microsoft.agent.user.email": "agent@contoso.com",
  "microsoft.a365.agent.blueprint.id": "blueprint-789"
}

Testing

  • ✅ All 1070 unit tests passing
  • ✅ CHANGELOG.md updated with breaking changes
  • ✅ All constant references updated across the codebase
  • ✅ Bug fix: Caller blueprint ID now uses correct attribute key (CALLER_AGENT_BLUEPRINT_ID_KEY)

Related Issues

Aligns with the official A365 Observability Schema and OpenTelemetry semantic conventions.

Copilot AI review requested due to automatic review settings February 19, 2026 01:03
@fpfp100 fpfp100 requested a review from a team as a code owner February 19, 2026 01:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for a new telemetry attribute schema (gated behind A365_USE_NEW_TELEMETRY_SCHEMA) in the observability SDK by renaming/selectively emitting span/baggage attributes and introducing caller metadata propagation into base scopes.

Changes:

  • Add CallerDetails support in OpenTelemetryScope and plumb it through ExecuteToolScope, InferenceScope, and InvokeAgentScope.
  • Gate/adjust exported attributes for the new schema (e.g., removing some legacy dimensions; switching to telemetry.sdk.* attributes).
  • Extend inference telemetry with thoughtProcess and add/expand unit tests around caller tagging.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/observability/core/scopes.test.ts Adds assertions that caller tags are applied for ExecuteTool/Inference scopes.
packages/agents-a365-observability/src/tracing/scopes/OpenTelemetryScope.ts Adds callerDetails param and applies caller tags in the base scope.
packages/agents-a365-observability/src/tracing/scopes/InvokeAgentScope.ts Routes callerDetails into base scope; handles InvokeAgent-only attrs in new schema.
packages/agents-a365-observability/src/tracing/scopes/InferenceScope.ts Plumbs callerDetails; adds gen_ai.agent.thought.process tagging.
packages/agents-a365-observability/src/tracing/scopes/ExecuteToolScope.ts Plumbs callerDetails into scope creation.
packages/agents-a365-observability/src/tracing/processors/util.ts Gates which baggage keys are copied into span attrs depending on schema.
packages/agents-a365-observability/src/tracing/processors/SpanProcessor.ts Switches from operation.source to telemetry.sdk.* attributes under new schema.
packages/agents-a365-observability/src/tracing/middleware/BaggageBuilder.ts Stops emitting correlation/hiring-manager baggage keys in new schema.
packages/agents-a365-observability/src/tracing/contracts.ts Adds InferenceDetails.thoughtProcess.
packages/agents-a365-observability/src/tracing/constants.ts Introduces schema flag and conditional key renames/new constants.

@fpfp100 fpfp100 force-pushed the feature/new-telemetry-schema branch from f167507 to 203104a Compare February 19, 2026 01:13
Copilot AI review requested due to automatic review settings February 19, 2026 01:21
@fpfp100 fpfp100 force-pushed the feature/new-telemetry-schema branch from 203104a to 6eee457 Compare February 19, 2026 01:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

…LEMETRY_SCHEMA env var

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@fpfp100 fpfp100 force-pushed the feature/new-telemetry-schema branch from 6eee457 to 7564849 Compare February 19, 2026 01:35
Add prebuild script to generate src/version.ts from package.json
(same pattern as agents-a365-runtime) so the telemetry SDK version
stays correct automatically instead of being hardcoded.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 19, 2026 01:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

jsl517 and others added 2 commits February 18, 2026 18:11
Use jest.isolateModules to validate raw old/new schema key strings
for caller attributes, catching regressions in constant definitions
regardless of which schema is active at runtime.

Also skip GEN_AI_AGENT_USER_ID_KEY from GENERIC_ATTRIBUTES in new
schema to avoid duplicate propagation (collides with GEN_AI_AGENT_AUID_KEY).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… agent keys

- Restore GEN_AI_CALLER_TENANT_ID_KEY and wire it through base scope,
  INVOKE_AGENT_ATTRIBUTES, and TurnContextUtils baggage pairs
- Add isolated-module tests validating caller agent key schema mappings
- Skip GEN_AI_AGENT_USER_ID_KEY from GENERIC_ATTRIBUTES in new schema
  to avoid duplicate propagation with GEN_AI_AGENT_AUID_KEY

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 19, 2026 02:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

jsl517 and others added 2 commits February 18, 2026 18:58
This constant duplicated GEN_AI_AGENT_AUID_KEY functionality.
The .NET SDK uses gen_ai.agent.userid as GenAiAgentAUIDKey,
so only GEN_AI_AGENT_AUID_KEY is needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- TELEMETRY_SDK_NAME_VALUE: Agent365Sdk → A365ObservabilitySDK
- GEN_AI_AGENT_AUID_KEY: microsoft.a365.agent.user.id → microsoft.agent.user.id
- GEN_AI_AGENT_BLUEPRINT_ID_KEY: microsoft.agent.blueprint.id → microsoft.a365.agent.blueprint.id

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 24, 2026 21:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Copy link
Contributor

@nikhilNava nikhilNava left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together, can you post the generated post body by the SDK for easy review?
Also please share the post body with Akhil and Jason to help with service implementation

@fpfp100 fpfp100 requested a review from a team as a code owner February 26, 2026 02:41
….call.result, remove GEN_AI_EXECUTION_SOURCE_ID_KEY, add server.address/port to InferenceScope

- Remove GEN_AI_RESPONSE_ID_KEY constant and all responseId references
  from InferenceScope, contracts, extensions-openai, and samples
- Rename gen_ai.event.content to gen_ai.tool.call.result for
  GEN_AI_EVENT_CONTENT and GEN_AI_TOOL_CALL_RESULT_KEY constants
- Remove GEN_AI_EXECUTION_SOURCE_ID_KEY from constants, util.ts,
  InvokeAgentScope, and BaggageBuilder.sourceMetadataId()
- Add endpoint (server.address/server.port) support to InferenceScope
  and InferenceDetails contract
- Update capture-post-body sample and agent.ts samples
- Update all affected tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 26, 2026 02:47
@fpfp100 fpfp100 force-pushed the feature/new-telemetry-schema branch from 48679f9 to a083413 Compare February 26, 2026 02:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 6 comments.

* @param correlationId The correlation ID
* @returns A context manager that restores the previous baggage on exit
*/
static setRequestContext(
Copy link
Contributor

Choose a reason for hiding this comment

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

This method can be removed as it doesnt do much. developer will have to use other setters anyway

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is also used in dotnet.

jsl517 and others added 2 commits March 2, 2026 12:45
…oviderName to AgentDetails

Remove hardcoded gen_ai.provider.name from OpenTelemetryScope base class.
Set it dynamically in InvokeAgentScope from AgentDetails.providerName,
matching InferenceScope which already uses InferenceDetails.providerName.
ExecuteTool spans no longer emit gen_ai.provider.name.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 2, 2026 20:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 7 comments.

jsl517 and others added 2 commits March 2, 2026 13:12
- Fix OutputScope: rename old schema constants (GEN_AI_EXECUTION_SOURCE_*
  to CHANNEL_*, remove GEN_AI_CALLER_TENANT_ID_KEY, remove executionType param)
- Fix scope-utils tests: use new schema attribute names, update input message
  format to match JSON.stringify change from main
- Fix output-scope test: adjust for removed executionType parameter
- Fix output-logging-middleware and baggage-middleware tests: use CHANNEL_NAME_KEY

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…eneric attributes, add callerDetails JSDoc

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 2, 2026 21:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.

jsl517 and others added 2 commits March 2, 2026 14:29
…remove dead code, fix copyright headers and stale JSDoc

- OutputScope: pass callerDetails to super() instead of manual caller tagging
- OutputScope: fix JSDoc removing stale "tenant" from callerDetails description
- OpenTelemetryScope: remove unused finalTags variable and exception field
- OpenTelemetryScope: remove unused Attributes import
- TurnContextUtils: fix stale JSDoc mentioning tenant in getCallerBaggagePairs
- constants.ts: remove misleading "server spans only" comment on SERVICE_NAME_KEY
- Fix copyright headers in contracts.ts, BaggageBuilder.ts, OpenAIAgentsTraceProcessor.ts, Utils.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 2, 2026 22:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

packages/agents-a365-observability-hosting/src/utils/TurnContextUtils.ts:27

  • if (!turnContext|| !turnContext.activity?.from) is missing whitespace around the || operator (and has a trailing space before {). This is likely to violate the repo's formatting/lint rules and should be fixed to keep CI lint clean.
  if (!turnContext|| !turnContext.activity?.from) { 
    return [];

jsl517 and others added 2 commits March 2, 2026 14:47
…hannelLink

Address nikhilNava review: rename methods to match schema naming convention.
Also update design doc to reflect new method names and attribute keys.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reverting to sourceMetadataName/sourceMetadataDescription — the full
sourceMetadata→channel rename will be done in a follow-up PR.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 2, 2026 23:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 28 out of 28 changed files in this pull request and generated 4 comments.

Resolve conflicts by merging both feature branches:
- Add both callerDetails (feature) and spanKind (main) parameters to ExecuteToolScope
- Fix removed GEN_AI_EVENT_CONTENT constant, replace with GEN_AI_TOOL_CALL_RESULT_KEY
- Update ScopeUtils to pass both parameters (callerDetails as undefined for now)
- Update all test signatures to match new parameter order

All tests passing (1070 tests).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 13, 2026 18:23
@fpfp100 fpfp100 force-pushed the feature/new-telemetry-schema branch from 2937802 to 48f26f2 Compare March 13, 2026 18:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 30 out of 31 changed files in this pull request and generated 1 comment.


You can also share your feedback on Copilot code review. Take the survey.

Breaking changes:
- Migrate human caller attributes to OTel standard (user.*, client.*)
- Migrate agent attributes to microsoft.agent.* namespace
- Migrate A2A caller attributes to microsoft.a365.caller.agent.* namespace
- Fix bug: Use CALLER_AGENT_BLUEPRINT_ID_KEY for caller's blueprint ID
- Update CHANGELOG.md with comprehensive breaking changes documentation
- Update all tests to use new constant names

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants