Skip to content

Add A365 manual scopes, processors, baggage and context propagation - #21

Merged
Hector Hernandez (hectorhdzg) merged 1 commit into
microsoft:mainfrom
hectorhdzg:hectorhdzg/a365-manual-apis-v2
Apr 17, 2026
Merged

Hector Hernandez (hectorhdzg) merged 1 commit into
microsoft:mainfrom
hectorhdzg:hectorhdzg/a365-manual-apis-v2

Conversation

@hectorhdzg

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new A365 “manual telemetry” API surface (scopes + context propagation + baggage + processors) and updates configuration/documentation to match upstream Agent365-nodejs conventions.

Changes:

  • Introduces A365 manual scopes (InvokeAgentScope, InferenceScope, ExecuteToolScope, OutputScope) plus message normalization/serialization helpers.
  • Adds context propagation utilities (ParentSpanRef + W3C traceparent inject/extract) and a per-request token context + per-request span processor.
  • Updates A365 env var names/parsing and adds samples + migration/docs + unit tests.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
test/internal/unit/a365/scopes.test.ts New unit tests for manual scopes behavior (attributes, serialization, timing, cancellation).
test/internal/unit/a365/perRequestSpanProcessor.test.ts New unit tests for per-request buffering/export behavior and env var parsing.
test/internal/unit/a365/messageUtils.test.ts New unit tests for message normalization/serialization helpers.
test/internal/unit/a365/contextPropagation.test.ts New unit tests for W3C context inject/extract and ParentSpanRef parenting.
test/internal/unit/a365/baggageBuilder.test.ts New unit tests for BaggageBuilder/BaggageScope baggage propagation.
test/internal/unit/a365/a365SpanProcessor.test.ts New unit tests for baggage→span enrichment processor and registries.
test/internal/unit/a365/a365Configuration.test.ts Updates tests for new env var names + auth scopes parsing behavior.
src/index.ts Re-exports newly added A365 APIs from package root.
src/distro/distro.ts Updates A365 enablement env var name in distro docs.
src/a365/scopes/index.ts Barrel export for manual scopes.
src/a365/scopes/OutputScope.ts Implements OutputScope for output message spans.
src/a365/scopes/OpenTelemetryScope.ts Adds base scope with span lifecycle, tagging, message recording, parent context support.
src/a365/scopes/InvokeAgentScope.ts Implements invoke-agent span + request/caller/endpoint tagging.
src/a365/scopes/InferenceScope.ts Implements inference span tagging (model/provider/tokens/finish reasons/etc.).
src/a365/scopes/ExecuteToolScope.ts Implements tool-execution span tagging + args/result serialization.
src/a365/processors/util.ts Defines attribute allowlists for baggage→span enrichment.
src/a365/processors/index.ts Barrel export for A365 processors and attribute registries.
src/a365/processors/PerRequestSpanProcessor.ts Implements per-trace buffering + export under saved Context + concurrency limits.
src/a365/processors/A365SpanProcessor.ts Implements baggage→span attribute enrichment on span start.
src/a365/middleware/index.ts Barrel export for baggage middleware.
src/a365/middleware/BaggageBuilder.ts Implements fluent BaggageBuilder and BaggageScope context carrier.
src/a365/message-utils.ts Adds message wrapper detection, normalization, serialization, and safe JSON serialization helper.
src/a365/index.ts Aggregates/exports new A365 public surface (scopes/constants/contracts/context/middleware/processors).
src/a365/contracts.ts Defines A365 message schema types, scope contracts, and span details/parent refs.
src/a365/context/tokenContext.ts Adds per-request export token context helpers (runWithExportToken, etc.).
src/a365/context.ts Adds ParentSpanRef utilities + W3C trace context inject/extract helpers.
src/a365/constants.ts Introduces A365 OTel attribute keys + operation names + SDK identity constants.
src/a365/configuration/A365Configuration.ts Updates env var names and parsing (booleans, scopes splitting, domain trimming).
samples/src/a365ManualScopes.ts New sample demonstrating manual scopes + cross-service context propagation.
samples/src/a365Export.ts Updates sample docs for new A365 env var names.
samples/README.md Adds sample entry/link for manual scopes sample.
README.md Updates documented A365 env vars (and adds log level env var mention).
MIGRATION_A365.md New migration guide from @microsoft/agents-a365-observability to @microsoft/opentelemetry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/a365/middleware/BaggageBuilder.ts
Comment thread src/a365/configuration/A365Configuration.ts
Comment thread README.md
Comment thread src/a365/scopes/OutputScope.ts
Comment thread src/a365/context.ts
Comment thread test/internal/unit/a365/a365SpanProcessor.test.ts
Comment thread src/a365/processors/PerRequestSpanProcessor.ts
Comment thread src/a365/scopes/OpenTelemetryScope.ts
@hectorhdzg
Hector Hernandez (hectorhdzg) merged commit 6fee946 into microsoft:main Apr 17, 2026
9 checks passed
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.

3 participants