Skip to content

Add inline chat OTel invocation span#322002

Open
eleanorjboyd wants to merge 1 commit into
microsoft:mainfrom
eleanorjboyd:quiet-otter
Open

Add inline chat OTel invocation span#322002
eleanorjboyd wants to merge 1 commit into
microsoft:mainfrom
eleanorjboyd:quiet-otter

Conversation

@eleanorjboyd

@eleanorjboyd eleanorjboyd commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary

Adds an ATIF-compatible root OTel invocation span for inline chat requests.

Inline chat previously emitted chat / execute_tool spans without the root invoke_agent span shape used by panel chat. ATIF converter starts from root invoke_agent spans, so inline-chat benchmark runs exported traces but produced no trajectory.json.

This change:

  • wraps the inline chat tool loop in invoke_agent Inline Chat
  • records agent-level metadata, status, token totals, response metadata, tool definitions, duration, and turn count
  • adds a focused regression test for the inline root span
  • updates the OTel monitoring docs to document inline chat's span hierarchy

Copilot AI review requested due to automatic review settings June 18, 2026 21:42
@eleanorjboyd eleanorjboyd self-assigned this Jun 18, 2026
joshspicer
joshspicer previously approved these changes Jun 18, 2026

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

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 Chat root 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),
},
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