diff --git a/CHANGELOG.md b/CHANGELOG.md index d61c5f77..212b941b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] +### Bugs Fixed +- Default `InvokeAgentScope` spans to `SpanKind.INTERNAL` while preserving explicit span-kind overrides. [#241](https://github.com/microsoft/opentelemetry-distro-javascript/pull/241) + ### Other Changes - Consolidate Dependabot updates for Vitest 4.1.11, Hono 4.13.7, qs 6.16.0, fast-uri 3.1.7, actions/deploy-pages 5.0.1, and actions/checkout 7.0.1. diff --git a/src/a365/scopes/InvokeAgentScope.ts b/src/a365/scopes/InvokeAgentScope.ts index bcfda81b..02f23c68 100644 --- a/src/a365/scopes/InvokeAgentScope.ts +++ b/src/a365/scopes/InvokeAgentScope.ts @@ -25,7 +25,8 @@ export class InvokeAgentScope extends OpenTelemetryScope { * @param invokeScopeDetails Scope-level details (endpoint). * @param agentDetails The agent identity. `tenantId` is required. * @param callerDetails Optional caller information (human, agent, or both for A2A). - * @param spanDetails Optional span configuration. + * @param spanDetails Optional span configuration. Defaults the span kind to + * `SpanKind.INTERNAL` when omitted. */ public static start( request: Request, @@ -56,7 +57,7 @@ export class InvokeAgentScope extends OpenTelemetryScope { const resolvedSpanDetails: SpanDetails = { ...spanDetails, - spanKind: spanDetails?.spanKind ?? SpanKind.CLIENT, + spanKind: spanDetails?.spanKind ?? SpanKind.INTERNAL, }; super( diff --git a/test/internal/unit/a365/scopes.test.ts b/test/internal/unit/a365/scopes.test.ts index 4c51f71e..b154e0dd 100644 --- a/test/internal/unit/a365/scopes.test.ts +++ b/test/internal/unit/a365/scopes.test.ts @@ -990,8 +990,8 @@ describe("Scopes", () => { }); it.each([ - ["CLIENT (default)", undefined, SpanKind.CLIENT], - ["SERVER", SpanKind.SERVER, SpanKind.SERVER], + ["INTERNAL (default)", undefined, SpanKind.INTERNAL], + ["SERVER (override)", SpanKind.SERVER, SpanKind.SERVER], ])("InvokeAgentScope spanKind: %s", (_label, input, expected) => { const scope = InvokeAgentScope.start( testRequest,