diff --git a/CHANGELOG.md b/CHANGELOG.md index 9462db2..f0e45e5 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) + ### Features Added - Add manual `sessionId` propagation to `ExecuteToolScope` and `InferenceScope`, plus opt-in custom baggage enrichment for recognized GenAI spans through `BaggageBuilder.customAttribute()` and `customAttributes()`. [#242](https://github.com/microsoft/opentelemetry-distro-javascript/pull/242) - Add GenAI v1.42 InvokeAgent request, response, cache-token, and provider attribute capture for manual A365 scopes. [#239](https://github.com/microsoft/opentelemetry-distro-javascript/pull/239) diff --git a/src/a365/scopes/InvokeAgentScope.ts b/src/a365/scopes/InvokeAgentScope.ts index b64c3e7..528b412 100644 --- a/src/a365/scopes/InvokeAgentScope.ts +++ b/src/a365/scopes/InvokeAgentScope.ts @@ -28,7 +28,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, @@ -59,7 +60,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 4728e6a..5ad566a 100644 --- a/test/internal/unit/a365/scopes.test.ts +++ b/test/internal/unit/a365/scopes.test.ts @@ -1003,8 +1003,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,