Skip to content

Comments

Support new telemetry schema attribute names#207

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

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

Conversation

@fpfp100
Copy link
Contributor

@fpfp100 fpfp100 commented Feb 19, 2026

Summary

  • Gate all attribute name changes behind A365_USE_NEW_TELEMETRY_SCHEMA env var
  • Rename gen_ai.* attributes to microsoft.* namespace when new schema is enabled
  • Remove gen_ai.agent.type, gen_ai.execution.type, correlation.id, hiring.manager.id from non-InvokeAgent spans in new schema
  • Replace operation.source with telemetry.sdk.* attributes in new schema
  • Add gen_ai.agent.thought.process support on InferenceScope
  • Add CallerDetails to base scope class (matching .NET SDK pattern)
  • Add caller agent attribute renames for A2A dimensions

Test plan

  • All 1059 existing tests pass (env var not set = old schema = no behavior change)
  • Run tests with A365_USE_NEW_TELEMETRY_SCHEMA=true to verify new attribute names

🤖 Generated with Claude Code

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.

Comment on lines 88 to 94
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_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';
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.
@@ -0,0 +1 @@
export const LIB_VERSION = "0.0.0-placeholder";
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 generated version.ts file is missing the required Microsoft copyright header. All TypeScript source files in the repository should include the copyright header even if they are generated during prebuild. Consider adding the copyright header to the prebuild script output or to a template.

Copilot generated this review using guidance from repository custom instructions.
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.

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';
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.
"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.
Comment on lines 89 to 90
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';
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.
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>
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.

2 participants