Add inline chat OTel invocation span#322002
Open
eleanorjboyd wants to merge 1 commit into
Open
Conversation
joshspicer
previously approved these changes
Jun 18, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a panel-chat–compatible invoke_agent root span around inline chat’s tool-calling loop so ATIF/trajectory conversion can anchor on inline chat traces, and documents + tests the resulting span hierarchy.
Changes:
- Add an
invoke_agent Inline Chatroot OTel span in the inline chat tool loop and attach agent-level attributes/metrics (model, usage totals, tool defs, duration, turn count). - Accumulate token usage across inline chat turns and record agent metrics.
- Add a focused regression test and update monitoring docs to include inline chat’s span tree.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/extension/inlineChat2/node/inlineChatIntent.ts | Introduces the inline-chat invoke_agent Inline Chat root span and aggregates per-turn usage into agent-level attributes/metrics. |
| extensions/copilot/src/extension/inlineChat2/test/node/inlineChatIntent.spec.ts | Adds a regression test asserting inline chat emits an invoke_agent root span with expected core attributes. |
| extensions/copilot/docs/monitoring/agent_monitoring.md | Documents that inline chat uses the same root invocation span shape as panel chat. |
| extensions/copilot/docs/monitoring/agent_monitoring_arch.md | Adds inline chat to the documented span hierarchy and source mapping table. |
Copilot's findings
- Files reviewed: 4/4 changed files
- Comments generated: 2
Comment on lines
+224
to
+226
| return this._otelService.startActiveSpan( | ||
| 'invoke_agent Inline Chat', | ||
| { |
Comment on lines
+228
to
+238
| attributes: { | ||
| [GenAiAttr.OPERATION_NAME]: GenAiOperationName.INVOKE_AGENT, | ||
| [GenAiAttr.PROVIDER_NAME]: GenAiProviderName.GITHUB, | ||
| [GenAiAttr.AGENT_NAME]: 'Inline Chat', | ||
| [GenAiAttr.CONVERSATION_ID]: conversation.sessionId, | ||
| [GenAiAttr.REQUEST_MODEL]: endpoint.model, | ||
| [CopilotChatAttr.SESSION_ID]: conversation.sessionId, | ||
| [CopilotChatAttr.INTENT]: this._intent.id, | ||
| [CopilotChatAttr.LOCATION]: ChatLocation.toStringShorter(ChatLocation.Editor), | ||
| [CopilotChatAttr.USER_REQUEST]: truncateForOTel(request.prompt, this._otelService.config.maxAttributeSizeChars), | ||
| }, |
a110891 to
349c609
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an ATIF-compatible root OTel invocation span for inline chat requests.
Inline chat previously emitted
chat/execute_toolspans without the rootinvoke_agentspan shape used by panel chat. ATIF converter starts from rootinvoke_agentspans, so inline-chat benchmark runs exported traces but produced notrajectory.json.This change:
invoke_agent Inline Chat