Rename SourceMetadata to Channel and align naming conventions#220
Rename SourceMetadata to Channel and align naming conventions#220
Conversation
…218) Systematically rename SourceMetadata -> Channel across the observability packages to better reflect the domain concept of an invocation channel. Also renames BaggageBuilder methods (serviceName -> operationSource, sourceMetadataName -> channelName, sourceMetadataDescription -> channelLink) and aligns endpoint.port serialization across all scope classes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Renames the observability “source metadata” concept to “channel” across the core SDK and hosting utilities, updates related fluent APIs, and aligns endpoint port span-attribute typing with OpenTelemetry conventions.
Changes:
- Renamed
SourceMetadata→ChannelandAgentRequest.sourceMetadata→AgentRequest.channelacross observability and hosting layers. - Renamed related helper/utility APIs (e.g.,
deriveSourceMetadataObject→deriveChannelObject,getSourceMetadataBaggagePairs→getChannelBaggagePairs,BaggageBuilder.serviceName→operationSource, etc.). - Fixed
endpoint.portspan attribute serialization to record numeric values (instead of strings) and updated tests accordingly.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/observability/extension/hosting/scope-utils.test.ts | Updates tests to validate deriveChannelObject and request.channel merge behavior. |
| tests/observability/extension/hosting/TurnContextUtils.test.ts | Updates tests to use getChannelBaggagePairs. |
| tests/observability/core/scopes.test.ts | Consolidates scope tests to assert conversation + channel tags together. |
| tests/observability/core/BaggageBuilder.test.ts | Adds coverage for new operationSource, channelName, channelLink fluent setters. |
| packages/agents-a365-observability/src/tracing/scopes/OutputScope.ts | Renames parameter/type usage from source metadata to channel for tagging. |
| packages/agents-a365-observability/src/tracing/scopes/InvokeAgentScope.ts | Reads request.channel for tags; records server port as a number. |
| packages/agents-a365-observability/src/tracing/scopes/InferenceScope.ts | Uses Channel type for tagging; records server port as a number. |
| packages/agents-a365-observability/src/tracing/scopes/ExecuteToolScope.ts | Uses Channel type for tagging; records server port as a number. |
| packages/agents-a365-observability/src/tracing/middleware/BaggageBuilder.ts | Renames fluent setters to operationSource, channelName, channelLink. |
| packages/agents-a365-observability/src/tracing/contracts.ts | Introduces Channel interface and replaces AgentRequest.sourceMetadata with channel. |
| packages/agents-a365-observability/src/index.ts | Re-exports Channel instead of SourceMetadata. |
| packages/agents-a365-observability/docs/design.md | Updates design doc wording and baggage setter names for channel. |
| packages/agents-a365-observability-hosting/src/utils/TurnContextUtils.ts | Renames baggage extraction helper to getChannelBaggagePairs. |
| packages/agents-a365-observability-hosting/src/utils/ScopeUtils.ts | Renames context derivation helper and propagates channel into scopes/details. |
| packages/agents-a365-observability-hosting/src/utils/BaggageBuilderUtils.ts | Renames helper to setChannelBaggage and wires to new TurnContextUtils function. |
| packages/agents-a365-observability-hosting/src/middleware/OutputLoggingMiddleware.ts | Uses deriveChannelObject and forwards channel to OutputScope. |
| packages/agents-a365-observability-hosting/src/middleware/BaggageMiddleware.ts | Uses getChannelBaggagePairs to populate baggage. |
| packages/agents-a365-observability-hosting/docs/design.md | Updates hosting design doc references to channel helpers. |
| CHANGELOG.md | Documents breaking renames and updates terminology. |
Comments suppressed due to low confidence (1)
CHANGELOG.md:38
CHANGELOG.mdnow has two separate "### Breaking Changes (@microsoft/agents-a365-observability-hosting)" sections under the same[Unreleased]heading, which makes the changelog harder to read and maintain. Please consolidate these into a single section (or rename one of them if it’s intended to be a different category).
### Breaking Changes (`@microsoft/agents-a365-observability-hosting`)
- **`ScopeUtils.deriveSourceMetadataObject()` renamed to `ScopeUtils.deriveChannelObject()`**.
- **`BaggageBuilderUtils.setSourceMetadataBaggage()` renamed to `BaggageBuilderUtils.setChannelBaggage()`**.
- **`getSourceMetadataBaggagePairs()` renamed to `getChannelBaggagePairs()`** in `TurnContextUtils`.
### Added
- **`OpenAIAgentsInstrumentationConfig.isContentRecordingEnabled`** — Optional `boolean` to enable content recording in OpenAI trace processor.
- **`LangChainTraceInstrumentor.instrument(module, options?)`** — New optional `{ isContentRecordingEnabled?: boolean }` parameter to enable content recording in LangChain tracer.
- **`truncateValue`** / **`MAX_ATTRIBUTE_LENGTH`** — Exported utilities for attribute value truncation (8192 char limit).
### Breaking Changes (`@microsoft/agents-a365-observability-hosting`)
- **`ScopeUtils.deriveAgentDetails(turnContext, authToken)`** — New required `authToken: string` parameter.
- **`ScopeUtils.populateInferenceScopeFromTurnContext(details, turnContext, authToken, ...)`** — New required `authToken: string` parameter.
- **`ScopeUtils.populateInvokeAgentScopeFromTurnContext(details, turnContext, authToken, ...)`** — New required `authToken: string` parameter.
- **`ScopeUtils.populateExecuteToolScopeFromTurnContext(details, turnContext, authToken, ...)`** — New required `authToken: string` parameter.
You can also share your feedback on Copilot code review. Take the survey.
packages/agents-a365-observability/src/tracing/scopes/InvokeAgentScope.ts
Show resolved
Hide resolved
packages/agents-a365-observability/src/tracing/scopes/ExecuteToolScope.ts
Show resolved
Hide resolved
- Add operationSource(value) to BaggageBuilder doc table in design.md - Update Channel interface JSDoc with channel-appropriate examples - Consolidate duplicate hosting breaking changes sections in CHANGELOG - Fix "source metadata" reference in OutputScope changelog entry - Add endpoint.port tests: numeric value for non-443 ports and omission for port 443 across ExecuteToolScope, InferenceScope, InvokeAgentScope Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
54bc03a to
5e967c4
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the observability and hosting SDKs to replace the legacy SourceMetadata concept with a clearer Channel model, and aligns related naming across scopes, baggage builders, utilities, docs, and tests. It also fixes endpoint.port tagging to consistently emit a numeric span attribute instead of a string.
Changes:
- Renamed
SourceMetadata→ChannelandAgentRequest.sourceMetadata→AgentRequest.channel, updating scopes/utilities accordingly. - Renamed
BaggageBuilderfluent methods tooperationSource(),channelName(),channelLink()and added test coverage for these. - Standardized
endpoint.porttagging across scopes to record non-443 ports as numbers and added regression tests.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/observability/extension/hosting/scope-utils.test.ts | Updates hosting ScopeUtils tests to use the new channel terminology/APIs. |
| tests/observability/extension/hosting/TurnContextUtils.test.ts | Switches tests to getChannelBaggagePairs() export. |
| tests/observability/core/scopes.test.ts | Adds/updates coverage for channel tagging and numeric endpoint.port attributes. |
| tests/observability/core/BaggageBuilder.test.ts | Adds tests for new BaggageBuilder method names and correct baggage keys. |
| packages/agents-a365-observability/src/tracing/scopes/OutputScope.ts | Renames scope parameter typing from SourceMetadata to Channel and updates tagging. |
| packages/agents-a365-observability/src/tracing/scopes/InvokeAgentScope.ts | Reads request.channel for channel tags and records port as number. |
| packages/agents-a365-observability/src/tracing/scopes/InferenceScope.ts | Renames parameter to channel and records port as number. |
| packages/agents-a365-observability/src/tracing/scopes/ExecuteToolScope.ts | Renames parameter to channel and records port as number. |
| packages/agents-a365-observability/src/tracing/middleware/BaggageBuilder.ts | Renames fluent methods to match updated domain terminology. |
| packages/agents-a365-observability/src/tracing/contracts.ts | Introduces Channel and updates AgentRequest to use channel. |
| packages/agents-a365-observability/src/index.ts | Re-exports Channel instead of SourceMetadata. |
| packages/agents-a365-observability/docs/design.md | Updates docs/examples and baggage setter table to reflect new names. |
| packages/agents-a365-observability-hosting/src/utils/TurnContextUtils.ts | Renames TurnContext extraction helper to getChannelBaggagePairs. |
| packages/agents-a365-observability-hosting/src/utils/ScopeUtils.ts | Renames/rewires derivation & merge logic to deriveChannelObject and request.channel. |
| packages/agents-a365-observability-hosting/src/utils/BaggageBuilderUtils.ts | Renames helper to setChannelBaggage and updates call chain. |
| packages/agents-a365-observability-hosting/src/middleware/OutputLoggingMiddleware.ts | Switches middleware to derive/pass channel metadata. |
| packages/agents-a365-observability-hosting/src/middleware/BaggageMiddleware.ts | Uses getChannelBaggagePairs when building baggage. |
| packages/agents-a365-observability-hosting/docs/design.md | Updates hosting docs to reflect channel naming and new helper names. |
| CHANGELOG.md | Documents breaking renames and updates terminology in release notes. |
Comments suppressed due to low confidence (1)
CHANGELOG.md:45
- The Unreleased section now contains multiple repeated "### Added" headings, which makes the changelog structure ambiguous and harder to follow (Keep a Changelog expects a single heading per type). Consider consolidating these into one "### Added" section (or splitting by package with subheadings) and keep all added items under it.
### Added
- **`OpenAIAgentsInstrumentationConfig.isContentRecordingEnabled`** — Optional `boolean` to enable content recording in OpenAI trace processor.
- **`LangChainTraceInstrumentor.instrument(module, options?)`** — New optional `{ isContentRecordingEnabled?: boolean }` parameter to enable content recording in LangChain tracer.
- **`truncateValue`** / **`MAX_ATTRIBUTE_LENGTH`** — Exported utilities for attribute value truncation (8192 char limit).
### Added
- **OutputScope**: Tracing scope for outgoing agent messages with caller details, conversation ID, channel information, and parent span linking.
- **BaggageMiddleware**: Middleware for automatic OpenTelemetry baggage propagation from TurnContext.
- **OutputLoggingMiddleware**: Middleware that creates OutputScope spans for outgoing messages with lazy parent span linking via `A365_PARENT_SPAN_KEY`.
- **ObservabilityHostingManager**: Manager for configuring hosting-layer observability middleware with `ObservabilityHostingOptions`.
### Added
- **Agent365ExporterOptions**: New `httpRequestTimeoutMilliseconds` option (default 30s) controls the per-HTTP-request timeout for backend calls. This is distinct from `exporterTimeoutMilliseconds` which controls the overall BatchSpanProcessor export deadline.
You can also share your feedback on Copilot code review. Take the survey.
packages/agents-a365-observability/src/tracing/scopes/OutputScope.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Renames the “invocation source metadata” concept to a clearer “channel” concept across the observability and hosting packages, updates related APIs/helpers, and fixes endpoint port attribute typing consistency in span tags.
Changes:
- Renamed
SourceMetadata→Channeland updatedAgentRequest.sourceMetadata→AgentRequest.channelacross packages, docs, and tests. - Renamed
BaggageBuilderfluent setters (serviceName→operationSource,sourceMetadataName/Description→channelName/channelLink) and hosting helpers to match. - Fixed
endpoint.porttagging to record non-443 ports as numbers (not strings) and added/updated tests for this behavior.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/observability/extension/hosting/scope-utils.test.ts | Updates tests for deriveChannelObject and request channel merge behavior. |
| tests/observability/extension/hosting/TurnContextUtils.test.ts | Updates test to use getChannelBaggagePairs. |
| tests/observability/core/scopes.test.ts | Adds coverage for channel tags + numeric endpoint.port serialization across scopes. |
| tests/observability/core/BaggageBuilder.test.ts | Adds coverage for renamed BaggageBuilder methods. |
| packages/agents-a365-observability/src/tracing/scopes/OutputScope.ts | Switches tagging input type from SourceMetadata to Channel. |
| packages/agents-a365-observability/src/tracing/scopes/InvokeAgentScope.ts | Reads request.channel and records endpoint.port as a number. |
| packages/agents-a365-observability/src/tracing/scopes/InferenceScope.ts | Switches to Channel and records endpoint.port as a number. |
| packages/agents-a365-observability/src/tracing/scopes/ExecuteToolScope.ts | Switches to Channel and records endpoint.port as a number. |
| packages/agents-a365-observability/src/tracing/middleware/BaggageBuilder.ts | Renames fluent baggage setters to new naming scheme. |
| packages/agents-a365-observability/src/tracing/contracts.ts | Introduces Channel and updates AgentRequest accordingly. |
| packages/agents-a365-observability/src/index.ts | Exports Channel instead of SourceMetadata. |
| packages/agents-a365-observability/docs/design.md | Updates docs/examples to refer to channel and renamed baggage setters. |
| packages/agents-a365-observability-hosting/src/utils/TurnContextUtils.ts | Renames baggage extractor to getChannelBaggagePairs. |
| packages/agents-a365-observability-hosting/src/utils/ScopeUtils.ts | Renames channel derivation/merge logic and updates scope population to pass channel. |
| packages/agents-a365-observability-hosting/src/utils/BaggageBuilderUtils.ts | Renames helper to setChannelBaggage and updates usage. |
| packages/agents-a365-observability-hosting/src/middleware/OutputLoggingMiddleware.ts | Uses derived channel when creating OutputScope. |
| packages/agents-a365-observability-hosting/src/middleware/BaggageMiddleware.ts | Uses getChannelBaggagePairs for baggage propagation. |
| packages/agents-a365-observability-hosting/docs/design.md | Updates hosting docs to reflect channel naming. |
| CHANGELOG.md | Documents breaking renames and updates terminology. |
You can also share your feedback on Copilot code review. Take the survey.
packages/agents-a365-observability-hosting/src/utils/TurnContextUtils.ts
Outdated
Show resolved
Hide resolved
- Fix misleading comment in OutputScope: remove "execution type" reference since OutputScope does not set execution type attributes - Fix TurnContextUtils JSDoc: change "link" to "subchannel description" to accurately describe what channelIdSubChannel provides - Consolidate three separate "### Added" sections into one in CHANGELOG Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Renames the invocation “source metadata” concept to “channel” across observability + hosting packages, updates related builder/middleware APIs, and fixes endpoint.port span attribute typing to record ports as numbers.
Changes:
- Renamed
SourceMetadata→Channeland updatedAgentRequest.sourceMetadata→AgentRequest.channelacross scopes, hosting utils, and docs. - Renamed
BaggageBuilderfluent setters tooperationSource(),channelName(),channelLink(). - Fixed
endpoint.porttagging to emit a numeric attribute (and added/updated tests accordingly).
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/observability/extension/hosting/scope-utils.test.ts | Updates hosting ScopeUtils tests for deriveChannelObject and request.channel merging. |
| tests/observability/extension/hosting/TurnContextUtils.test.ts | Updates test to call getChannelBaggagePairs instead of getSourceMetadataBaggagePairs. |
| tests/observability/core/scopes.test.ts | Adds coverage for channel tags and numeric endpoint.port serialization across scopes. |
| tests/observability/core/BaggageBuilder.test.ts | Adds parameterized coverage for renamed BaggageBuilder methods and keys. |
| packages/agents-a365-observability/src/tracing/scopes/OutputScope.ts | Renames SourceMetadata usage to Channel for span tags. |
| packages/agents-a365-observability/src/tracing/scopes/InvokeAgentScope.ts | Switches request.sourceMetadata → request.channel and records endpoint.port as a number. |
| packages/agents-a365-observability/src/tracing/scopes/InferenceScope.ts | Renames param to channel and records endpoint.port as a number. |
| packages/agents-a365-observability/src/tracing/scopes/ExecuteToolScope.ts | Renames param to channel and records endpoint.port as a number. |
| packages/agents-a365-observability/src/tracing/middleware/BaggageBuilder.ts | Renames fluent setters (serviceName → operationSource, etc.). |
| packages/agents-a365-observability/src/tracing/contracts.ts | Renames exported interface SourceMetadata → Channel and updates AgentRequest. |
| packages/agents-a365-observability/src/index.ts | Re-exports Channel instead of SourceMetadata. |
| packages/agents-a365-observability/docs/design.md | Updates design docs for channel naming and new BaggageBuilder method names. |
| packages/agents-a365-observability-hosting/src/utils/TurnContextUtils.ts | Renames getSourceMetadataBaggagePairs → getChannelBaggagePairs and updates docs. |
| packages/agents-a365-observability-hosting/src/utils/ScopeUtils.ts | Renames deriveSourceMetadataObject → deriveChannelObject and updates request merging to channel. |
| packages/agents-a365-observability-hosting/src/utils/BaggageBuilderUtils.ts | Renames setSourceMetadataBaggage → setChannelBaggage. |
| packages/agents-a365-observability-hosting/src/middleware/OutputLoggingMiddleware.ts | Threads derived channel info through OutputScope creation. |
| packages/agents-a365-observability-hosting/src/middleware/BaggageMiddleware.ts | Switches to getChannelBaggagePairs. |
| packages/agents-a365-observability-hosting/docs/design.md | Updates hosting design docs to channel naming. |
| CHANGELOG.md | Documents breaking changes and updates wording from source metadata → channel. |
You can also share your feedback on Copilot code review. Take the survey.
Summary
SourceMetadata→Channel: Renamed the exported interface and all references across observability packages to better reflect the domain concept of an invocation channel (e.g., Teams, Slack, web).BaggageBuildermethod renames:serviceName()→operationSource(),sourceMetadataName()→channelName(),sourceMetadataDescription()→channelLink().deriveSourceMetadataObject()→deriveChannelObject(),setSourceMetadataBaggage()→setChannelBaggage(),getSourceMetadataBaggagePairs()→getChannelBaggagePairs().endpoint.portserialization acrossInferenceScope,InvokeAgentScope, andExecuteToolScope(pass as number, not string).operationSource(),channelName(),channelLink()onBaggageBuilder; simplified duplicate test coverage.Test plan
SourceMetadataor old method names🤖 Generated with Claude Code